forked from ezsystems/ezpublish-kernel
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request ezsystems#1134 from ezsystems/EZP-23867-legacy_bri…
…dge_signal_slots Separate legacy and new stack cache handling
- Loading branch information
Showing
40 changed files
with
324 additions
and
154 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<?php | ||
/** | ||
* This file is part of the eZ Publish Kernel package | ||
* | ||
* @copyright Copyright (C) eZ Systems AS. All rights reserved. | ||
* @license For full copyright and license information view LICENSE file distributed with this source code. | ||
*/ | ||
namespace eZ\Bundle\EzPublishLegacyBundle\Cache; | ||
|
||
trait Switchable | ||
{ | ||
/** @var bool */ | ||
private $isSwitchedOn = true; | ||
|
||
public function switchOn() | ||
{ | ||
$this->isSwitchedOn = true; | ||
} | ||
|
||
public function switchOff() | ||
{ | ||
$this->isSwitchedOn = false; | ||
} | ||
|
||
/** | ||
* Checks if the switch is off | ||
* @return bool | ||
*/ | ||
public function isSwitchedOn() | ||
{ | ||
return $this->isSwitchedOn; | ||
} | ||
|
||
/** | ||
* Checks if the switch is off | ||
* @return bool | ||
*/ | ||
public function isSwitchedOff() | ||
{ | ||
return !$this->isSwitchedOn; | ||
} | ||
} |
46 changes: 46 additions & 0 deletions
46
eZ/Bundle/EzPublishLegacyBundle/Cache/SwitchableHttpCachePurger.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,46 @@ | ||
<?php | ||
/** | ||
* This file is part of the EzPublishLegacyBridge package | ||
* | ||
* @copyright Copyright (C) eZ Systems AS. All rights reserved. | ||
* @license For full copyright and license information view LICENSE file distributed with this source code. | ||
*/ | ||
namespace eZ\Bundle\EzPublishLegacyBundle\Cache; | ||
|
||
use eZ\Publish\Core\MVC\Symfony\Cache\GatewayCachePurger; | ||
|
||
/** | ||
* A GatewayCachePurger decorator that allows the actual purger to be switched on/off. | ||
*/ | ||
class SwitchableHttpCachePurger implements GatewayCachePurger | ||
{ | ||
use Switchable; | ||
|
||
/** @var \eZ\Publish\Core\MVC\Symfony\Cache\GatewayCachePurger */ | ||
private $gatewayCachePurger; | ||
|
||
public function __construct( GatewayCachePurger $gatewayCachePurger ) | ||
{ | ||
$this->gatewayCachePurger = $gatewayCachePurger; | ||
} | ||
|
||
public function purge( $cacheElements ) | ||
{ | ||
if ( $this->isSwitchedOff() ) | ||
{ | ||
return $cacheElements; | ||
} | ||
|
||
return $this->gatewayCachePurger->purge( $cacheElements ); | ||
} | ||
|
||
public function purgeAll() | ||
{ | ||
if ( $this->isSwitchedOff() ) | ||
{ | ||
return; | ||
} | ||
|
||
$this->gatewayCachePurger->purgeAll(); | ||
} | ||
} |
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
Oops, something went wrong.