Skip to content

Commit 49e6db9

Browse files
Merge branch 'application-server-part2' of github.com:magento-performance/magento2ce into ACPT-1277
2 parents 8b132d7 + 446fbd3 commit 49e6db9

File tree

47 files changed

+586
-129
lines changed

Some content is hidden

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

47 files changed

+586
-129
lines changed

app/code/Magento/Catalog/Model/Layer.php

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
use Magento\Catalog\Api\CategoryRepositoryInterface;
99
use Magento\Framework\Exception\NoSuchEntityException;
1010
use Magento\Catalog\Model\ResourceModel\Product\Attribute\CollectionFactory as AttributeCollectionFactory;
11+
use Magento\Framework\ObjectManager\ResetAfterRequestInterface;
1112

1213
/**
1314
* Catalog view layer model
@@ -17,7 +18,7 @@
1718
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
1819
* @since 100.0.2
1920
*/
20-
class Layer extends \Magento\Framework\DataObject
21+
class Layer extends \Magento\Framework\DataObject implements ResetAfterRequestInterface
2122
{
2223
/**
2324
* Product collections array
@@ -41,29 +42,21 @@ class Layer extends \Magento\Framework\DataObject
4142
protected $registry = null;
4243

4344
/**
44-
* Store manager
45-
*
4645
* @var \Magento\Store\Model\StoreManagerInterface
4746
*/
4847
protected $_storeManager;
4948

5049
/**
51-
* Catalog product
52-
*
5350
* @var \Magento\Catalog\Model\ResourceModel\Product
5451
*/
5552
protected $_catalogProduct;
5653

5754
/**
58-
* Attribute collection factory
59-
*
6055
* @var AttributeCollectionFactory
6156
*/
6257
protected $_attributeCollectionFactory;
6358

6459
/**
65-
* Layer state factory
66-
*
6760
* @var \Magento\Catalog\Model\Layer\StateFactory
6861
*/
6962
protected $_layerStateFactory;
@@ -187,6 +180,7 @@ public function apply()
187180

188181
/**
189182
* Retrieve current category model
183+
*
190184
* If no category found in registry, the root will be taken
191185
*
192186
* @return \Magento\Catalog\Model\Category
@@ -266,4 +260,12 @@ public function getState()
266260

267261
return $state;
268262
}
263+
264+
/**
265+
* @inheritDoc
266+
*/
267+
public function _resetState(): void
268+
{
269+
$this->_productCollections = [];
270+
}
269271
}

app/code/Magento/Catalog/Model/Product/Type/Price.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
use Magento\Catalog\Model\Product;
1111
use Magento\Customer\Api\GroupManagementInterface;
12+
use Magento\Framework\ObjectManager\ResetAfterRequestInterface;
1213
use Magento\Framework\Pricing\PriceCurrencyInterface;
1314
use Magento\Store\Model\Store;
1415
use Magento\Catalog\Api\Data\ProductTierPriceExtensionFactory;
@@ -23,7 +24,7 @@
2324
* @SuppressWarnings(PHPMD.CookieAndSessionMisuse)
2425
* @since 100.0.2
2526
*/
26-
class Price
27+
class Price implements ResetAfterRequestInterface
2728
{
2829
/**
2930
* Product price cache tag
@@ -657,4 +658,12 @@ public function isTierPriceFixed()
657658
{
658659
return true;
659660
}
661+
662+
/**
663+
* @inheritDoc
664+
*/
665+
public function _resetState(): void
666+
{
667+
self::$attributeCache = [];
668+
}
660669
}

app/code/Magento/CatalogGraphQl/DataProvider/Product/LayeredNavigation/Builder/Aggregations/Category/IncludeDirectChildrenOnly.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
use Magento\Catalog\Api\CategoryListInterface;
1111
use Magento\Framework\Api\SearchCriteriaBuilder;
12+
use Magento\Framework\ObjectManager\ResetAfterRequestInterface;
1213
use Magento\Framework\Search\Response\Aggregation;
1314
use Magento\Framework\Search\Response\AggregationFactory;
1415
use Magento\Framework\Search\Response\BucketFactory;
@@ -18,7 +19,7 @@
1819
/**
1920
* Class to include only direct subcategories of category in aggregation
2021
*/
21-
class IncludeDirectChildrenOnly
22+
class IncludeDirectChildrenOnly implements ResetAfterRequestInterface
2223
{
2324
/**
2425
* @var string
@@ -160,4 +161,12 @@ private function filterBucketValues(
160161
}
161162
return array_values($categoryBucketValues);
162163
}
164+
165+
/**
166+
* @inheritDoc
167+
*/
168+
public function _resetState(): void
169+
{
170+
$this->filter = [];
171+
}
163172
}

app/code/Magento/CatalogGraphQl/DataProvider/Product/LayeredNavigation/Builder/Category.php

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,14 @@
1818
use Magento\Framework\Api\Search\BucketInterface;
1919
use Magento\Framework\App\ResourceConnection;
2020
use Magento\Framework\GraphQl\Query\Uid;
21+
use Magento\Framework\ObjectManager\ResetAfterRequestInterface;
2122

2223
/**
2324
* Category layer builder
2425
*
2526
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
2627
*/
27-
class Category implements LayerBuilderInterface
28+
class Category implements LayerBuilderInterface, ResetAfterRequestInterface
2829
{
2930
/**
3031
* @var string
@@ -201,4 +202,17 @@ private function getStoreCategoryIds(int $storeId): array
201202
);
202203
return $collection->getAllIds();
203204
}
205+
206+
/**
207+
* @inheritDoc
208+
*/
209+
public function _resetState(): void
210+
{
211+
self::$bucketMap = [
212+
self::CATEGORY_BUCKET => [
213+
'request_name' => 'category_uid',
214+
'label' => 'Category'
215+
],
216+
];
217+
}
204218
}

app/code/Magento/CatalogGraphQl/Model/AttributesJoiner.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,12 @@
1212
use GraphQL\Language\AST\NodeKind;
1313
use Magento\Eav\Model\Entity\Collection\AbstractCollection;
1414
use Magento\Framework\GraphQl\Schema\Type\ResolveInfo;
15+
use Magento\Framework\ObjectManager\ResetAfterRequestInterface;
1516

1617
/**
1718
* Joins attributes for provided field node field names.
1819
*/
19-
class AttributesJoiner
20+
class AttributesJoiner implements ResetAfterRequestInterface
2021
{
2122
/**
2223
* @var array
@@ -177,4 +178,12 @@ private function setSelectionsForFieldNode(FieldNode $fieldNode, array $selected
177178
{
178179
$this->queryFields[$fieldNode->name->value][$fieldNode->name->loc->start] = $selectedFields;
179180
}
181+
182+
/**
183+
* @inheritDoc
184+
*/
185+
public function _resetState(): void
186+
{
187+
$this->queryFields = [];
188+
}
180189
}

app/code/Magento/CatalogGraphQl/Model/Resolver/Products/DataProvider/Deferred/Product.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,5 +153,6 @@ public function _resetState(): void
153153
{
154154
$this->productList = [];
155155
$this->productSkus = [];
156+
$this->attributeCodes = [];
156157
}
157158
}

app/code/Magento/CatalogRule/Model/Rule.php

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,26 +31,28 @@
3131
use Magento\Framework\Model\Context;
3232
use Magento\Framework\Model\ResourceModel\AbstractResource;
3333
use Magento\Framework\Model\ResourceModel\Iterator;
34+
use Magento\Framework\ObjectManager\ResetAfterRequestInterface;
3435
use Magento\Framework\Registry;
3536
use Magento\Framework\Serialize\Serializer\Json;
3637
use Magento\Framework\Stdlib\DateTime;
3738
use Magento\Framework\Stdlib\DateTime\TimezoneInterface;
39+
use Magento\Rule\Model\AbstractModel;
3840
use Magento\Store\Model\StoreManagerInterface;
3941

4042
/**
4143
* Catalog Rule data model
4244
*
43-
* @method \Magento\CatalogRule\Model\Rule setFromDate(string $value)
44-
* @method \Magento\CatalogRule\Model\Rule setToDate(string $value)
45-
* @method \Magento\CatalogRule\Model\Rule setCustomerGroupIds(string $value)
45+
* @method Rule setFromDate(string $value)
46+
* @method Rule setToDate(string $value)
47+
* @method Rule setCustomerGroupIds(string $value)
4648
* @method string getWebsiteIds()
47-
* @method \Magento\CatalogRule\Model\Rule setWebsiteIds(string $value)
49+
* @method Rule setWebsiteIds(string $value)
4850
* @SuppressWarnings(PHPMD.TooManyFields)
4951
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
5052
* @SuppressWarnings(PHPMD.ExcessivePublicCount)
5153
* @SuppressWarnings(PHPMD.CookieAndSessionMisuse)
5254
*/
53-
class Rule extends \Magento\Rule\Model\AbstractModel implements RuleInterface, IdentityInterface
55+
class Rule extends AbstractModel implements RuleInterface, IdentityInterface, ResetAfterRequestInterface
5456
{
5557
/**
5658
* Prefix of model events names
@@ -917,4 +919,12 @@ public function clearPriceRulesData(): void
917919
{
918920
self::$_priceRulesData = [];
919921
}
922+
923+
/**
924+
* @inheritDoc
925+
*/
926+
public function _resetState(): void
927+
{
928+
self::$_priceRulesData = [];
929+
}
920930
}

app/code/Magento/Cms/Model/Page/IdentityMap.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,12 @@
88
namespace Magento\Cms\Model\Page;
99

1010
use Magento\Cms\Model\Page;
11+
use Magento\Framework\ObjectManager\ResetAfterRequestInterface;
1112

1213
/**
1314
* Identity map of loaded pages.
1415
*/
15-
class IdentityMap
16+
class IdentityMap implements ResetAfterRequestInterface
1617
{
1718
/**
1819
* @var Page[]
@@ -69,4 +70,12 @@ public function clear(): void
6970
{
7071
$this->pages = [];
7172
}
73+
74+
/**
75+
* @inheritDoc
76+
*/
77+
public function _resetState(): void
78+
{
79+
$this->pages = [];
80+
}
7281
}

app/code/Magento/ConfigurableProduct/Pricing/Price/ConfigurableOptionsProvider.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,12 @@
99
use Magento\Catalog\Api\Data\ProductInterface;
1010
use Magento\ConfigurableProduct\Model\Product\Type\Configurable;
1111
use Magento\Framework\App\ObjectManager;
12+
use Magento\Framework\ObjectManager\ResetAfterRequestInterface;
1213

1314
/**
1415
* Provide configurable child products for price calculation
1516
*/
16-
class ConfigurableOptionsProvider implements ConfigurableOptionsProviderInterface
17+
class ConfigurableOptionsProvider implements ConfigurableOptionsProviderInterface, ResetAfterRequestInterface
1718
{
1819
/**
1920
* @var Configurable
@@ -56,4 +57,12 @@ public function getProducts(ProductInterface $product)
5657
}
5758
return $this->products[$product->getId()];
5859
}
60+
61+
/**
62+
* @inheritDoc
63+
*/
64+
public function _resetState(): void
65+
{
66+
$this->products = [];
67+
}
5968
}

app/code/Magento/Customer/Model/Address/AbstractAddress.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use Magento\Customer\Model\Data\Address as AddressData;
1515
use Magento\Framework\App\ObjectManager;
1616
use Magento\Framework\Model\AbstractExtensibleModel;
17+
use Magento\Framework\ObjectManager\ResetAfterRequestInterface;
1718

1819
/**
1920
* Address abstract model
@@ -35,7 +36,7 @@
3536
* @api
3637
* @since 100.0.2
3738
*/
38-
class AbstractAddress extends AbstractExtensibleModel implements AddressModelInterface
39+
class AbstractAddress extends AbstractExtensibleModel implements AddressModelInterface, ResetAfterRequestInterface
3940
{
4041
/**
4142
* Possible customer address types
@@ -736,4 +737,13 @@ private function processCustomAttribute(array $attribute): array
736737

737738
return $attribute;
738739
}
740+
741+
/**
742+
* @inheritDoc
743+
*/
744+
public function _resetState(): void
745+
{
746+
self::$_countryModels = [];
747+
self::$_regionModels = [];
748+
}
739749
}

app/code/Magento/Customer/Model/Customer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1308,7 +1308,7 @@ public function isResetPasswordLinkTokenExpired()
13081308
}
13091309

13101310
$hourDifference = floor(($currentTimestamp - $tokenTimestamp) / (60 * 60));
1311-
1311+
13121312
return $hourDifference >= $expirationPeriod;
13131313
}
13141314

app/code/Magento/Directory/Helper/Data.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
use Magento\Framework\App\Helper\AbstractHelper;
1717
use Magento\Framework\App\Helper\Context;
1818
use Magento\Framework\Json\Helper\Data as JsonData;
19+
use Magento\Framework\ObjectManager\ResetAfterRequestInterface;
1920
use Magento\Store\Model\ScopeInterface;
2021
use Magento\Store\Model\StoreManagerInterface;
2122

@@ -26,7 +27,7 @@
2627
* @since 100.0.2
2728
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
2829
*/
29-
class Data extends AbstractHelper
30+
class Data extends AbstractHelper implements ResetAfterRequestInterface
3031
{
3132
private const STORE_ID = 'store_id';
3233

@@ -435,4 +436,13 @@ private function getCurrentScope(): array
435436

436437
return $scope;
437438
}
439+
440+
/**
441+
* @inheritDoc
442+
*/
443+
public function _resetState(): void
444+
{
445+
$this->_regionJson = null;
446+
$this->_currencyCache = [];
447+
}
438448
}

0 commit comments

Comments
 (0)