-
Notifications
You must be signed in to change notification settings - Fork 205
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
OXDEV-7771 Add refactoring suggestions
- Loading branch information
1 parent
9e9e46e
commit 50d1aab
Showing
14 changed files
with
86 additions
and
173 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
15 changes: 0 additions & 15 deletions
15
source/Internal/Framework/Cache/Pool/ShopPoolFactoryInterface.php
This file was deleted.
Oops, something went wrong.
28 changes: 0 additions & 28 deletions
28
source/Internal/Framework/Cache/Pool/ShopPoolNameFactory.php
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
13 changes: 0 additions & 13 deletions
13
source/Internal/Framework/Cache/Pool/ShopPoolServiceInterface.php
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
source/Internal/Framework/Cache/ShopCacheCleanerInterface.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?php | ||
|
||
/** | ||
* Copyright © OXID eSales AG. All rights reserved. | ||
* See LICENSE file for license details. | ||
*/ | ||
|
||
namespace OxidEsales\EshopCommunity\Internal\Framework\Cache; | ||
|
||
interface ShopCacheCleanerInterface | ||
{ | ||
public function clear(int $shopId): void; | ||
|
||
public function clearAll(): void; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<?php | ||
|
||
/** | ||
* Copyright © OXID eSales AG. All rights reserved. | ||
* See LICENSE file for license details. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace OxidEsales\EshopCommunity\Internal\Framework\Cache; | ||
|
||
use OxidEsales\EshopCommunity\Internal\Framework\Cache\Pool\CacheItemPoolFactoryInterface; | ||
use OxidEsales\EshopCommunity\Internal\Framework\Templating\Cache\ShopTemplateCacheServiceInterface; | ||
use OxidEsales\EshopCommunity\Internal\Transition\Adapter\ShopAdapterInterface; | ||
use OxidEsales\EshopCommunity\Internal\Transition\Utility\ContextInterface; | ||
|
||
class ShopCacheFacade implements ShopCacheCleanerInterface | ||
{ | ||
public function __construct( | ||
private readonly ContextInterface $context, | ||
private readonly CacheItemPoolFactoryInterface $cacheItemPoolFactory, | ||
private readonly ShopAdapterInterface $shopAdapter, | ||
private readonly ShopTemplateCacheServiceInterface $templateCacheService, | ||
) { | ||
} | ||
|
||
public function clear(int $shopId): void | ||
{ | ||
$this->shopAdapter->invalidateModulesCache(); | ||
$this->templateCacheService->invalidateCache($shopId); | ||
$this->cacheItemPoolFactory->create($shopId)->clear(); | ||
} | ||
|
||
public function clearAll(): void | ||
{ | ||
$this->shopAdapter->invalidateModulesCache(); | ||
$this->templateCacheService->invalidateAllShopsCache(); | ||
foreach ($this->context->getAllShopIds() as $shopId) { | ||
$this->cacheItemPoolFactory->create($shopId)->clear(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,11 @@ | ||
imports: | ||
- { resource: Pool/services.yaml } | ||
- { resource: Command/services.yaml } | ||
|
||
services: | ||
_defaults: | ||
autowire: true | ||
|
||
OxidEsales\EshopCommunity\Internal\Framework\Cache\ShopCacheCleanerInterface: | ||
class: OxidEsales\EshopCommunity\Internal\Framework\Cache\ShopCacheFacade | ||
public: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters