Skip to content

Commit bc99d54

Browse files
NEXT-14221 - Remove cache feature flag
1 parent 0c2559b commit bc99d54

File tree

130 files changed

+82
-5453
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

130 files changed

+82
-5453
lines changed

UPGRADE-6.2.md

+1-7
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,7 @@ The new indexers work as follows:
411411
2. each indexer takes care of indexing a whole entity
412412
3. if several data on an entity need to be indexed, a single indexer takes care of the successive updating of the data
413413
4. an event is thrown at the end of the indexer so that plugins can subscribe to the event to index additional data for this entity
414-
5. finally, the updated ids are passed to the `CacheClearer` to invalidate the corresponding caches
414+
415415

416416
#### The new base class
417417
The base `Shopware\Core\Framework\DataAbstractionLayer\Indexing\EntityIndexer` class looks as follows:
@@ -458,7 +458,6 @@ namespace Shopware\Core\Content\Product\DataAbstractionLayer;
458458
459459
use Shopware\Core\Content\Product\Events\ProductIndexerEvent;
460460
use Shopware\Core\Content\Product\ProductDefinition;
461-
use Shopware\Core\Framework\Adapter\Cache\CacheClearer;
462461
use Shopware\Core\Framework\DataAbstractionLayer\Dbal\Common\IteratorFactory;
463462
use Shopware\Core\Framework\DataAbstractionLayer\EntityRepositoryInterface;
464463
use Shopware\Core\Framework\DataAbstractionLayer\Event\EntityWrittenContainerEvent;
@@ -474,9 +473,6 @@ class ProductIndexer extends EntityIndexer
474473
/** @var EntityRepositoryInterface */
475474
private $repository;
476475
477-
/** @var CacheClearer */
478-
private $cacheClearer;
479-
480476
/** @var EventDispatcherInterface */
481477
private $eventDispatcher;
482478
@@ -523,8 +519,6 @@ class ProductIndexer extends EntityIndexer
523519
// update all required data
524520
525521
$this->eventDispatcher->dispatch(new ProductIndexerEvent($ids, $message->getContext()));
526-
527-
$this->cacheClearer->invalidateIds($ids, ProductDefinition::ENTITY_NAME);
528522
}
529523
}
530524
```

changelog/_unreleased/2021-03-08-moved-cache-layer-from-dal-to-store-api.md

-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
---
22
title: Moved cache layer from DAL to store api
33
issue: NEXT-11735
4-
flag: FEATURE_NEXT_10514
54
author: OliverSkroblin
65
author_email: [email protected]
76
author_github: OliverSkroblin
@@ -24,24 +23,20 @@ author_github: OliverSkroblin
2423
* Added `ShippingMethodRouteCacheTagsEvent`, which is triggered when the cache item is written, and the attached tags are determined
2524
* Added cache layer for product suggest store api route
2625
* Added `CachedProductSuggestRoute`, which adds a cache around the product suggest route
27-
* Added `CachedProductSuggestRouteInvalidator`, which invalidates the cache for the route
2826
* Added `ProductSuggestRouteCacheKeyEvent`, which is triggered when the cache key for the route is generated
2927
* Added `ProductSuggestRouteCacheTagsEvent`, which is triggered when the cache item is written, and the attached tags are determined
3028
* Added cache layer for product search store api route
3129
* Added `CachedProductSearchRoute`, which adds a cache around the product search route
32-
* Added `CachedProductSearchRouteInvalidator`, which invalidates the cache for the route
3330
* Added `ProductSearchRouteCacheKeyEvent`, which is triggered when the cache key for the route is generated
3431
* Added `ProductSearchRouteCacheTagsEvent`, which is triggered when the cache item is written, and the attached tags are determined
3532
* Added `ResolvedCriteriaProductSearchRoute`, which resolves the criteria before the cached route is called. This way the route gets a resolved criterion and does not have to listen to all request parameters.
3633
* Added cache layer for product listing store api route
3734
* Added `CachedProductListingRoute`, which adds a cache around the product listing route
38-
* Added `CachedProductListingRouteInvalidator`, which invalidates the cache for the route
3935
* Added `ProductListingRouteCacheKeyEvent`, which is triggered when the cache key for the route is generated
4036
* Added `ProductListingRouteCacheTagsEvent`, which is triggered when the cache item is written, and the attached tags are determined
4137
* Added `ResolveCriteriaProductListingRoute`, which resolves the criteria before the cached route is called. This way the route gets a resolved criterion and does not have to listen to all request parameters.
4238
* Added cache layer for product detail store api route
4339
* Added `CachedProductDetailRoute`, which adds a cache around the product detail route
44-
* Added `CachedProductDetailRouteInvalidator`, which invalidates the cache for the route
4540
* Added `ProductDetailRouteCacheKeyEvent`, which is triggered when the cache key for the route is generated
4641
* Added `ProductDetailRouteCacheTagsEvent`, which is triggered when the cache item is written, and the attached tags are determined
4742
* Added cache layer for payment method store api route

changelog/_unreleased/2021-03-18-add-cross-selling-and-category-route-cache.md

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
---
22
title: Add cross selling and category route cache
33
issue: NEXT-14084
4-
flag: FEATURE_NEXT_10514
54
author: OliverSkroblin
65
author_email: [email protected]
76
author_github: OliverSkroblin

phpstan-baseline.neon

-50
Original file line numberDiff line numberDiff line change
@@ -2190,16 +2190,6 @@ parameters:
21902190
count: 1
21912191
path: src/Core/Framework/Bundle.php
21922192

2193-
-
2194-
message: "#^Method Shopware\\\\Core\\\\Framework\\\\Context\\:\\:disableCache\\(\\) has no return typehint specified\\.$#"
2195-
count: 1
2196-
path: src/Core/Framework/Context.php
2197-
2198-
-
2199-
message: "#^Method Shopware\\\\Core\\\\Framework\\\\Context\\:\\:enableCache\\(\\) has no return typehint specified\\.$#"
2200-
count: 1
2201-
path: src/Core/Framework/Context.php
2202-
22032193
-
22042194
message: "#^Method Shopware\\\\Core\\\\Framework\\\\Context\\:\\:enableInheritance\\(\\) has no return typehint specified\\.$#"
22052195
count: 1
@@ -2210,38 +2200,8 @@ parameters:
22102200
count: 1
22112201
path: src/Core/Framework/Context.php
22122202

2213-
-
2214-
message: "#^Parameter \\#1 \\$aggregation of method Shopware\\\\Core\\\\Framework\\\\DataAbstractionLayer\\\\Cache\\\\CachedEntityAggregator\\:\\:getAggregationResult\\(\\) expects Shopware\\\\Core\\\\Framework\\\\DataAbstractionLayer\\\\Search\\\\Aggregation\\\\Aggregation, Shopware\\\\Core\\\\Framework\\\\DataAbstractionLayer\\\\Search\\\\Aggregation\\\\Aggregation\\|null given\\.$#"
2215-
count: 1
2216-
path: src/Core/Framework/DataAbstractionLayer/Cache/CachedEntityAggregator.php
2217-
2218-
-
2219-
message: "#^Parameter \\#1 \\$aggregation of method Shopware\\\\Core\\\\Framework\\\\DataAbstractionLayer\\\\Cache\\\\CachedEntityAggregator\\:\\:removeFilterAggregation\\(\\) expects Shopware\\\\Core\\\\Framework\\\\DataAbstractionLayer\\\\Search\\\\Aggregation\\\\Aggregation, Shopware\\\\Core\\\\Framework\\\\DataAbstractionLayer\\\\Search\\\\Aggregation\\\\Aggregation\\|null given\\.$#"
2220-
count: 1
2221-
path: src/Core/Framework/DataAbstractionLayer/Cache/CachedEntityAggregator.php
2222-
2223-
-
2224-
message: "#^Method Shopware\\\\Core\\\\Framework\\\\DataAbstractionLayer\\\\Cache\\\\CachedEntityAggregator\\:\\:getAggregation\\(\\) has no return typehint specified\\.$#"
2225-
count: 1
2226-
path: src/Core/Framework/DataAbstractionLayer/Cache/CachedEntityAggregator.php
2227-
2228-
-
2229-
message: "#^Method Shopware\\\\Core\\\\Framework\\\\DataAbstractionLayer\\\\Cache\\\\CachedEntityReader\\:\\:loadFilterResult\\(\\) has no return typehint specified\\.$#"
2230-
count: 1
2231-
path: src/Core/Framework/DataAbstractionLayer/Cache/CachedEntityReader.php
2232-
22332203
-
22342204
message: "#^Parameter \\#1 \\$str of function md5 expects string, string\\|false given\\.$#"
2235-
count: 7
2236-
path: src/Core/Framework/DataAbstractionLayer/Cache/EntityCacheKeyGenerator.php
2237-
2238-
-
2239-
message: "#^Cannot call method getFields\\(\\) on Shopware\\\\Core\\\\Framework\\\\DataAbstractionLayer\\\\EntityDefinition\\|null\\.$#"
2240-
count: 1
2241-
path: src/Core/Framework/DataAbstractionLayer/Cache/EntityCacheKeyGenerator.php
2242-
2243-
-
2244-
message: "#^Parameter \\#1 \\$definition of method Shopware\\\\Core\\\\Framework\\\\DataAbstractionLayer\\\\Cache\\\\EntityCacheKeyGenerator\\:\\:getFieldTag\\(\\) expects Shopware\\\\Core\\\\Framework\\\\DataAbstractionLayer\\\\EntityDefinition, Shopware\\\\Core\\\\Framework\\\\DataAbstractionLayer\\\\EntityDefinition\\|null given\\.$#"
22452205
count: 2
22462206
path: src/Core/Framework/DataAbstractionLayer/Cache/EntityCacheKeyGenerator.php
22472207

@@ -2320,11 +2280,6 @@ parameters:
23202280
count: 1
23212281
path: src/Core/Framework/DataAbstractionLayer/Dbal/EntityDefinitionQueryHelper.php
23222282

2323-
-
2324-
message: "#^Parameter \\#2 \\$field of method Shopware\\\\Core\\\\Framework\\\\DataAbstractionLayer\\\\Dbal\\\\EntityDefinitionQueryHelper\\:\\:isInherited\\(\\) expects Shopware\\\\Core\\\\Framework\\\\DataAbstractionLayer\\\\Field\\\\Field, Shopware\\\\Core\\\\Framework\\\\DataAbstractionLayer\\\\Field\\\\Field\\|null given\\.$#"
2325-
count: 3
2326-
path: src/Core/Framework/DataAbstractionLayer/Dbal/EntityDefinitionQueryHelper.php
2327-
23282283
-
23292284
message: "#^Cannot call method buildAccessor\\(\\) on Shopware\\\\Core\\\\Framework\\\\DataAbstractionLayer\\\\Dbal\\\\FieldAccessorBuilder\\\\FieldAccessorBuilderInterface\\|null\\.$#"
23302285
count: 1
@@ -4730,11 +4685,6 @@ parameters:
47304685
count: 1
47314686
path: src/Storefront/Framework/Media/StorefrontMediaValidatorRegistry.php
47324687

4733-
-
4734-
message: "#^Method Shopware\\\\Storefront\\\\Framework\\\\Cache\\\\ObjectCacheKeyFinder\\:\\:loop\\(\\) has parameter \\$data with no typehint specified\\.$#"
4735-
count: 1
4736-
path: src/Storefront/Framework/Cache/ObjectCacheKeyFinder.php
4737-
47384688
-
47394689
message: "#^Parameter \\#1 \\$mimeType of class Shopware\\\\Storefront\\\\Framework\\\\Media\\\\Exception\\\\FileTypeNotAllowedException constructor expects string, string\\|null given\\.$#"
47404690
count: 1

psalm.xml

-2
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@
1515
<file name="src/Docs/Resources/current/60-references-internals/10-core/50-checkout-process/_examples/10-cart-example.php"/>
1616
<file name="src/Docs/Resources/deprecated/2-internals/1-core/50-checkout-process/_examples/10-cart-example.php"/>
1717

18-
<!-- @internal (FEATURE_NEXT_10514) remove this entry -->
19-
<file name="src/Core/Framework/Adapter/Cache/CacheInvalidationLogger.php"/>
2018
<directory name="src/*/Resources/app" />
2119
</ignoreFiles>
2220
</projectFiles>

src/Core/Checkout/Cart/CachedRuleLoader.php

-5
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
use Shopware\Core\Content\Rule\RuleCollection;
77
use Shopware\Core\Framework\Adapter\Cache\CacheCompressor;
88
use Shopware\Core\Framework\Context;
9-
use Shopware\Core\Framework\Feature;
109
use Symfony\Component\Cache\Adapter\TagAwareAdapterInterface;
1110

1211
class CachedRuleLoader extends AbstractRuleLoader
@@ -33,10 +32,6 @@ public function getDecorated(): AbstractRuleLoader
3332

3433
public function load(Context $context): RuleCollection
3534
{
36-
if (!Feature::isActive('FEATURE_NEXT_10514')) {
37-
return $this->getDecorated()->load($context);
38-
}
39-
4035
$item = $this->cache->getItem(self::CACHE_KEY);
4136

4237
try {

src/Core/Checkout/Cart/CachedRuleLoaderInvalidator.php

-4
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
use Shopware\Core\Content\Rule\Event\RuleIndexerEvent;
66
use Shopware\Core\Framework\Adapter\Cache\CacheInvalidationLogger;
7-
use Shopware\Core\Framework\Feature;
87
use Shopware\Core\Framework\Plugin\Event\PluginPostActivateEvent;
98
use Shopware\Core\Framework\Plugin\Event\PluginPostDeactivateEvent;
109
use Shopware\Core\Framework\Plugin\Event\PluginPostInstallEvent;
@@ -35,9 +34,6 @@ public static function getSubscribedEvents()
3534

3635
public function invalidate(): void
3736
{
38-
if (!Feature::isActive('FEATURE_NEXT_10514')) {
39-
return;
40-
}
4137
$this->logger->log([CachedRuleLoader::CACHE_KEY]);
4238
}
4339
}

src/Core/Checkout/Cart/CartRuleLoader.php

-4
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,6 @@
1111

1212
class CartRuleLoader
1313
{
14-
/**
15-
* @feature-deprecated (flag:FEATURE_NEXT_10514) tag:v6.4.0 - Use \Shopware\Core\Checkout\Cart\CachedRuleLoader::CACHE_KEY instead
16-
*/
17-
public const CHECKOUT_RULE_LOADER_CACHE_KEY = CachedRuleLoader::CACHE_KEY;
1814
private const MAX_ITERATION = 7;
1915

2016
/**

src/Core/Checkout/Customer/DataAbstractionLayer/CustomerIndexer.php

-17
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,12 @@
44

55
use Shopware\Core\Checkout\Customer\CustomerDefinition;
66
use Shopware\Core\Checkout\Customer\Event\CustomerIndexerEvent;
7-
use Shopware\Core\Framework\Adapter\Cache\CacheClearer;
87
use Shopware\Core\Framework\DataAbstractionLayer\Dbal\Common\IteratorFactory;
98
use Shopware\Core\Framework\DataAbstractionLayer\EntityRepositoryInterface;
109
use Shopware\Core\Framework\DataAbstractionLayer\Event\EntityWrittenContainerEvent;
1110
use Shopware\Core\Framework\DataAbstractionLayer\Indexing\EntityIndexer;
1211
use Shopware\Core\Framework\DataAbstractionLayer\Indexing\EntityIndexingMessage;
1312
use Shopware\Core\Framework\DataAbstractionLayer\Indexing\ManyToManyIdFieldUpdater;
14-
use Shopware\Core\Framework\Feature;
1513
use Symfony\Contracts\EventDispatcher\EventDispatcherInterface;
1614

1715
class CustomerIndexer extends EntityIndexer
@@ -26,11 +24,6 @@ class CustomerIndexer extends EntityIndexer
2624
*/
2725
private $repository;
2826

29-
/**
30-
* @var CacheClearer
31-
*/
32-
private $cacheClearer;
33-
3427
/**
3528
* @var ManyToManyIdFieldUpdater
3629
*/
@@ -44,13 +37,11 @@ class CustomerIndexer extends EntityIndexer
4437
public function __construct(
4538
IteratorFactory $iteratorFactory,
4639
EntityRepositoryInterface $repository,
47-
CacheClearer $cacheClearer,
4840
ManyToManyIdFieldUpdater $manyToManyIdFieldUpdater,
4941
EventDispatcherInterface $eventDispatcher
5042
) {
5143
$this->iteratorFactory = $iteratorFactory;
5244
$this->repository = $repository;
53-
$this->cacheClearer = $cacheClearer;
5445
$this->manyToManyIdFieldUpdater = $manyToManyIdFieldUpdater;
5546
$this->eventDispatcher = $eventDispatcher;
5647
}
@@ -101,13 +92,5 @@ public function handle(EntityIndexingMessage $message): void
10192
$this->manyToManyIdFieldUpdater->update(CustomerDefinition::ENTITY_NAME, $ids, $context);
10293

10394
$this->eventDispatcher->dispatch(new CustomerIndexerEvent($ids, $context));
104-
105-
//@internal (flag:FEATURE_NEXT_10514) Remove with feature flag
106-
if (!Feature::isActive('FEATURE_NEXT_10514')) {
107-
$this->cacheClearer->invalidateIds(
108-
array_unique(array_merge($ids)),
109-
CustomerDefinition::ENTITY_NAME
110-
);
111-
}
11295
}
11396
}

src/Core/Checkout/Customer/SalesChannel/LoadWishlistRoute.php

+1-5
Original file line numberDiff line numberDiff line change
@@ -134,11 +134,7 @@ private function loadProducts(string $wishlistId, Criteria $criteria, SalesChann
134134
$event = new CustomerWishlistLoaderCriteriaEvent($criteria, $context);
135135
$this->eventDispatcher->dispatch($event);
136136

137-
$products = $context->getContext()->disableCache(
138-
function () use ($criteria, $context) {
139-
return $this->productRepository->search($criteria, $context);
140-
}
141-
);
137+
$products = $this->productRepository->search($criteria, $context);
142138

143139
$event = new CustomerWishlistProductListingResultEvent($request, $products, $context);
144140
$this->eventDispatcher->dispatch($event);

src/Core/Checkout/DependencyInjection/customer.xml

-1
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,6 @@
230230
<service id="Shopware\Core\Checkout\Customer\DataAbstractionLayer\CustomerIndexer">
231231
<argument type="service" id="Shopware\Core\Framework\DataAbstractionLayer\Dbal\Common\IteratorFactory"/>
232232
<argument type="service" id="customer.repository"/>
233-
<argument type="service" id="Shopware\Core\Framework\Adapter\Cache\CacheClearer"/>
234233
<argument type="service" id="Shopware\Core\Framework\DataAbstractionLayer\Indexing\ManyToManyIdFieldUpdater"/>
235234
<argument type="service" id="event_dispatcher"/>
236235
<tag name="shopware.entity_indexer" priority="100"/>

src/Core/Checkout/DependencyInjection/promotion.xml

-4
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,6 @@
200200
<service id="Shopware\Core\Checkout\Promotion\DataAbstractionLayer\PromotionIndexer">
201201
<argument type="service" id="Shopware\Core\Framework\DataAbstractionLayer\Dbal\Common\IteratorFactory"/>
202202
<argument type="service" id="promotion.repository"/>
203-
<argument type="service" id="Shopware\Core\Framework\Adapter\Cache\CacheClearer"/>
204203
<argument type="service" id="Shopware\Core\Checkout\Promotion\DataAbstractionLayer\PromotionExclusionUpdater"/>
205204
<argument type="service" id="Shopware\Core\Checkout\Promotion\DataAbstractionLayer\PromotionRedemptionUpdater"/>
206205
<tag name="shopware.entity_indexer"/>
@@ -209,13 +208,10 @@
209208

210209
<service id="Shopware\Core\Checkout\Promotion\DataAbstractionLayer\PromotionRedemptionUpdater">
211210
<argument type="service" id="Doctrine\DBAL\Connection"/>
212-
<argument type="service" id="Shopware\Core\Framework\Adapter\Cache\CacheClearer"/>
213211
<tag name="kernel.event_subscriber"/>
214212
</service>
215213

216214
<service id="Shopware\Core\Checkout\Promotion\DataAbstractionLayer\PromotionExclusionUpdater">
217-
<argument type="service" id="Shopware\Core\Framework\DataAbstractionLayer\Cache\EntityCacheKeyGenerator"/>
218-
<argument type="service" id="Shopware\Core\Framework\Adapter\Cache\CacheClearer"/>
219215
<argument type="service" id="Doctrine\DBAL\Connection"/>
220216
</service>
221217

src/Core/Checkout/Payment/SalesChannel/CachedPaymentMethodRoute.php

-5
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
use Shopware\Core\Framework\DataAbstractionLayer\Cache\EntityCacheKeyGenerator;
1212
use Shopware\Core\Framework\DataAbstractionLayer\FieldSerializer\JsonFieldSerializer;
1313
use Shopware\Core\Framework\DataAbstractionLayer\Search\Criteria;
14-
use Shopware\Core\Framework\Feature;
1514
use Shopware\Core\Framework\Routing\Annotation\Entity;
1615
use Shopware\Core\Framework\Routing\Annotation\RouteScope;
1716
use Shopware\Core\Framework\Routing\Annotation\Since;
@@ -105,10 +104,6 @@ public function getDecorated(): AbstractPaymentMethodRoute
105104
*/
106105
public function load(Request $request, SalesChannelContext $context, Criteria $criteria): PaymentMethodRouteResponse
107106
{
108-
if (!Feature::isActive('FEATURE_NEXT_10514')) {
109-
return $this->getDecorated()->load($request, $context, $criteria);
110-
}
111-
112107
if ($context->hasState(...$this->states)) {
113108
$this->logger->info('cache-miss: ' . self::buildName($context->getSalesChannelId()));
114109

src/Core/Checkout/Payment/SalesChannel/CachedPaymentMethodRouteInvalidator.php

-5
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
use Shopware\Core\Checkout\Payment\PaymentMethodDefinition;
77
use Shopware\Core\Framework\Adapter\Cache\CacheInvalidationLogger;
88
use Shopware\Core\Framework\DataAbstractionLayer\Event\EntityWrittenContainerEvent;
9-
use Shopware\Core\Framework\Feature;
109
use Shopware\Core\Framework\Uuid\Uuid;
1110
use Shopware\Core\System\SalesChannel\Aggregate\SalesChannelPaymentMethod\SalesChannelPaymentMethodDefinition;
1211
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
@@ -36,10 +35,6 @@ public static function getSubscribedEvents()
3635

3736
public function invalidate(EntityWrittenContainerEvent $event): void
3837
{
39-
if (!Feature::isActive('FEATURE_NEXT_10514')) {
40-
return;
41-
}
42-
4338
$logs = array_merge(
4439
$this->getChangedPaymentMethods($event),
4540
$this->getChangedAssignments($event)

0 commit comments

Comments
 (0)