|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* @copyright Copyright (C) eZ Systems AS. All rights reserved. |
|
5
|
|
|
* @license For full copyright and license information view LICENSE file distributed with this source code. |
|
6
|
|
|
*/ |
|
7
|
|
|
namespace eZ\Publish\Core\Persistence\Cache; |
|
8
|
|
|
|
|
9
|
|
|
use eZ\Publish\Core\Persistence\Cache\Adapter\InMemoryClearingProxyAdapter; |
|
10
|
|
|
use eZ\Publish\Core\Persistence\Cache\InMemory\InMemoryCache; |
|
11
|
|
|
use eZ\Publish\SPI\Persistence\Handler as PersistenceHandler; |
|
12
|
|
|
|
|
13
|
|
|
/** |
|
14
|
|
|
* Internal abstract handler for use in other SPI Persistence Cache Handlers. |
|
15
|
|
|
* |
|
16
|
|
|
* @internal Only for use as abstract in eZ\Publish\Core\Persistence\Cache\*Handlers. |
|
17
|
|
|
*/ |
|
18
|
|
|
abstract class AbstractInMemoryPersistenceHandler extends AbstractInMemoryHandler |
|
19
|
|
|
{ |
|
20
|
|
|
/** |
|
21
|
|
|
* @var \eZ\Publish\SPI\Persistence\Handler |
|
22
|
|
|
*/ |
|
23
|
|
|
protected $persistenceHandler; |
|
24
|
|
|
|
|
25
|
|
|
/** |
|
26
|
|
|
* Setups current handler with everything needed. |
|
27
|
|
|
* |
|
28
|
|
|
* @param \eZ\Publish\Core\Persistence\Cache\Adapter\InMemoryClearingProxyAdapter $cache |
|
29
|
|
|
* @param \eZ\Publish\Core\Persistence\Cache\PersistenceLogger $logger |
|
30
|
|
|
* @param \eZ\Publish\Core\Persistence\Cache\InMemory\InMemoryCache $inMemory |
|
31
|
|
|
* @param \eZ\Publish\SPI\Persistence\Handler $persistenceHandler |
|
32
|
|
|
*/ |
|
33
|
|
|
public function __construct( |
|
34
|
|
|
InMemoryClearingProxyAdapter $cache, |
|
35
|
|
|
PersistenceLogger $logger, |
|
36
|
|
|
InMemoryCache $inMemory, |
|
37
|
|
|
PersistenceHandler $persistenceHandler |
|
38
|
|
|
) { |
|
39
|
|
|
parent::__construct($cache, $logger, $inMemory); |
|
40
|
|
|
$this->persistenceHandler = $persistenceHandler; |
|
41
|
|
|
|
|
42
|
|
|
$this->init(); |
|
43
|
|
|
} |
|
44
|
|
|
|
|
45
|
|
|
/** |
|
46
|
|
|
* Optional function to initialize handler without having to overload __construct(). |
|
47
|
|
|
*/ |
|
48
|
|
|
protected function init(): void |
|
49
|
|
|
{ |
|
50
|
|
|
// overload to add init logic if needed in handler |
|
51
|
|
|
} |
|
52
|
|
|
} |
|
53
|
|
|
|