Skip to content

Commit

Permalink
revert: "feat: mysql cache tag invalidator storage" (shopware#6031)
Browse files Browse the repository at this point in the history
  • Loading branch information
AydinHassan authored Jan 8, 2025
1 parent 2aa6523 commit c4a197a
Show file tree
Hide file tree
Showing 17 changed files with 17 additions and 502 deletions.
4 changes: 1 addition & 3 deletions UPGRADE-6.5.md
Original file line number Diff line number Diff line change
Expand Up @@ -497,12 +497,10 @@ shopware:
cache:
invalidation:
delay_options:
storage: redis
storage: cache
dsn: 'redis://localhost'
```

Since 6.6.10.0 we also have a MySQL implementation available: `\Shopware\Core\Framework\Adapter\Cache\InvalidatorStorage\MySQLInvalidatorStorage`. Use it via `mysql`

# 6.5.5.0
Shopware 6.5 introduces a new more flexible stock management system. Please see the [ADR](adr/2023-05-15-stock-api.md) for a more detailed description of the why & how.

Expand Down
8 changes: 2 additions & 6 deletions UPGRADE-6.6.md
Original file line number Diff line number Diff line change
Expand Up @@ -854,12 +854,10 @@ shopware:
cache:
invalidation:
delay_options:
storage: redis
storage: cache
dsn: 'redis://localhost'
```
Since 6.6.10.0 we also have a MySQL implementation available: `\Shopware\Core\Framework\Adapter\Cache\InvalidatorStorage\MySQLInvalidatorStorage`. Use it via `mysql`
# General Core Breaking Changes
## Symfony 7 upgrade
Expand Down Expand Up @@ -2070,12 +2068,10 @@ shopware:
cache:
invalidation:
delay_options:
storage: redis
storage: cache
dsn: 'redis://localhost'
```
Since 6.6.10.0 we also have a MySQL implementation available: `\Shopware\Core\Framework\Adapter\Cache\InvalidatorStorage\MySQLInvalidatorStorage`. Use it via `mysql`
## Introduced in 6.5.5.0
## New stock handling implementation is now the default
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,10 @@ shopware:
cache:
invalidation:
delay_options:
storage: redis
storage: cache
dsn: 'redis://localhost'
```
Since 6.6.10.0 we also have a MySQL implementation available: `\Shopware\Core\Framework\Adapter\Cache\InvalidatorStorage\MySQLInvalidatorStorage`. Use it via `mysql`

___
# Next Major Version Changes
Expand All @@ -42,8 +40,6 @@ shopware:
cache:
invalidation:
delay_options:
storage: redis
storage: cache
dsn: 'redis://localhost'
```

Since 6.6.10.0 we also have a MySQL implementation available: `\Shopware\Core\Framework\Adapter\Cache\InvalidatorStorage\MySQLInvalidatorStorage`. Use it via `mysql`
5 changes: 2 additions & 3 deletions config-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -584,11 +584,10 @@
"properties": {
"storage": {
"type": "string",
"default": "mysql",
"default": "cache",
"enum": [
"cache",
"redis",
"mysql"
"redis"
]
},
"dsn": {
Expand Down
5 changes: 5 additions & 0 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -2245,6 +2245,11 @@ parameters:
count: 1
path: src/Core/Framework/DataAbstractionLayer/Dbal/QueryBuilder.php

-
message: "#^Throwing new exceptions within classes are not allowed\\. Please use domain exception pattern\\. See https\\://github\\.com/shopware/platform/blob/v6\\.4\\.20\\.0/adr/2022\\-02\\-24\\-domain\\-exceptions\\.md$#"
count: 1
path: src/Core/Framework/DataAbstractionLayer/Doctrine/MultiInsertQueryQueue.php

-
message: "#^Throwing new exceptions within classes are not allowed\\. Please use domain exception pattern\\. See https\\://github\\.com/shopware/platform/blob/v6\\.4\\.20\\.0/adr/2022\\-02\\-24\\-domain\\-exceptions\\.md$#"
count: 3
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ class DataAbstractionLayerException extends HttpException
public const PRIMARY_KEY_NOT_PROVIDED = 'FRAMEWORK__PRIMARY_KEY_NOT_PROVIDED';
public const NO_GENERATOR_FOR_FIELD_TYPE = 'FRAMEWORK__NO_GENERATOR_FOR_FIELD_TYPE';
public const FOREIGN_KEY_NOT_FOUND_IN_DEFINITION = 'FRAMEWORK__FOREIGN_KEY_NOT_FOUND_IN_DEFINITION';
public const INVALID_CHUNK_SIZE = 'FRAMEWORK__INVALID_CHUNK_SIZE';

public static function invalidSerializerField(string $expectedClass, Field $field): self
{
Expand Down Expand Up @@ -773,14 +772,4 @@ public static function foreignKeyNotFoundInDefinition(string $association, strin
['association' => $association, 'entityDefinition' => $entityDefinition]
);
}

public static function invalidChunkSize(int $size): self
{
return new self(
Response::HTTP_INTERNAL_SERVER_ERROR,
self::INVALID_CHUNK_SIZE,
'Parameter $chunkSize needs to be a positive integer starting with 1, "{{ size }}" given',
['size' => $size]
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ class DefinitionValidator
'refresh_token',
'usage_data_entity_deletion',
'one_time_tasks',
'invalidation_tags',
];

private const IGNORED_ENTITY_PROPERTIES = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

use Doctrine\DBAL\Connection;
use Doctrine\DBAL\ParameterType;
use Shopware\Core\Framework\DataAbstractionLayer\DataAbstractionLayerException;
use Shopware\Core\Framework\DataAbstractionLayer\Dbal\EntityDefinitionQueryHelper;
use Shopware\Core\Framework\Log\Package;

Expand Down Expand Up @@ -33,7 +32,9 @@ public function __construct(
private readonly bool $useReplace = false
) {
if ($chunkSize < 1) {
throw DataAbstractionLayerException::invalidChunkSize($chunkSize);
throw new \InvalidArgumentException(
\sprintf('Parameter $chunkSize needs to be a positive integer starting with 1, "%d" given', $chunkSize)
);
}
$this->chunkSize = $chunkSize;
}
Expand Down Expand Up @@ -69,17 +70,6 @@ public function addInsert(string $table, array $data, ?array $types = null): voi
];
}

/**
* @param list<array<string, mixed>> $rows
* @param array<string, ParameterType::*>|null $types
*/
public function addInserts(string $table, array $rows, ?array $types = null): void
{
foreach ($rows as $row) {
$this->addInsert($table, $row, $types);
}
}

public function execute(): void
{
if (empty($this->inserts)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public function __construct(
}

/**
* @param array<int|string, mixed> $params
* @param array<string, mixed> $params
*/
public function execute(array $params = []): int
{
Expand Down
7 changes: 0 additions & 7 deletions src/Core/Framework/DependencyInjection/cache.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,6 @@
<tag name="shopware.cache.invalidator.storage" storage="redis"/>
</service>

<service id="shopware.cache.invalidator.storage.mysql" class="Shopware\Core\Framework\Adapter\Cache\InvalidatorStorage\MySQLInvalidatorStorage" lazy="true">
<argument type="service" id="Doctrine\DBAL\Connection"/>
<argument type="service" id="logger"/>

<tag name="shopware.cache.invalidator.storage" storage="mysql"/>
</service>

<service id="shopware.cache.invalidator.storage.locator" class="Shopware\Core\Framework\DependencyInjection\TaggedServiceLocator">
<argument type="tagged_locator" tag="shopware.cache.invalidator.storage" index-by="storage" />
</service>
Expand Down
2 changes: 1 addition & 1 deletion src/Core/Framework/Resources/config/packages/shopware.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,7 @@ shopware:
invalidation:
delay: 0
delay_options:
storage: mysql
storage: redis
http_cache: ['logged-in', 'cart-filled']
product_listing_route: []
product_detail_route: []
Expand Down

This file was deleted.

Loading

0 comments on commit c4a197a

Please sign in to comment.