@@ -40,211 +40,211 @@ |
||
40 | 40 | |
41 | 41 | abstract class ClusterPoolAbstract implements ClusterPoolInterface |
42 | 42 | { |
43 | - use TaggableCacheItemPoolTrait; |
|
44 | - use ClusterPoolTrait { |
|
45 | - TaggableCacheItemPoolTrait::__construct as private __parentConstruct; |
|
46 | - } |
|
47 | - |
|
48 | - public const STRATEGY = [ |
|
49 | - AggregatorInterface::STRATEGY_FULL_REPLICATION => FullReplicationCluster::class, |
|
50 | - AggregatorInterface::STRATEGY_SEMI_REPLICATION => SemiReplicationCluster::class, |
|
51 | - AggregatorInterface::STRATEGY_MASTER_SLAVE => MasterSlaveReplicationCluster::class, |
|
52 | - AggregatorInterface::STRATEGY_RANDOM_REPLICATION => RandomReplicationCluster::class, |
|
53 | - ]; |
|
54 | - |
|
55 | - /** |
|
56 | - * @var AggregatablePoolInterface[] |
|
57 | - */ |
|
58 | - protected array $clusterPools; |
|
59 | - |
|
60 | - /** |
|
61 | - * ClusterPoolAbstract constructor. |
|
62 | - * @param string $clusterName |
|
63 | - * @param EventManagerInterface $em |
|
64 | - * @param ExtendedCacheItemPoolInterface ...$driverPools |
|
65 | - * @throws PhpfastcacheDriverCheckException |
|
66 | - * @throws PhpfastcacheDriverConnectException |
|
67 | - * @throws PhpfastcacheInvalidArgumentException |
|
68 | - * @throws PhpfastcacheCoreException |
|
69 | - * @throws PhpfastcacheDriverException |
|
70 | - * @throws PhpfastcacheIOException |
|
71 | - */ |
|
72 | - public function __construct(string $clusterName, EventManagerInterface $em, AggregatablePoolInterface ...$driverPools) |
|
73 | - { |
|
74 | - if (count($driverPools) < 2) { |
|
75 | - throw new PhpfastcacheInvalidArgumentException('A cluster requires at least two pools to be working.'); |
|
76 | - } |
|
77 | - $this->clusterPools = $driverPools; |
|
78 | - $this->__parentConstruct(new ConfigurationOption(), $clusterName, $em); |
|
79 | - $this->setEventManager(EventManager::getInstance()); |
|
80 | - $this->setClusterPoolsAggregator(); |
|
81 | - } |
|
82 | - |
|
83 | - protected function setClusterPoolsAggregator(): void |
|
84 | - { |
|
85 | - foreach ($this->clusterPools as $clusterPool) { |
|
86 | - $clusterPool->setAggregatedBy($this); |
|
87 | - } |
|
88 | - } |
|
89 | - |
|
90 | - /** |
|
91 | - * @inheritDoc |
|
92 | - */ |
|
93 | - public function getIO(): DriverIO |
|
94 | - { |
|
95 | - $io = new DriverIO(); |
|
96 | - foreach ($this->clusterPools as $clusterPool) { |
|
97 | - $io->setReadHit($io->getReadHit() + $clusterPool->getIO()->getReadHit()) |
|
98 | - ->setReadMiss($io->getReadMiss() + $clusterPool->getIO()->getReadMiss()) |
|
99 | - ->setWriteHit($io->getWriteHit() + $clusterPool->getIO()->getWriteHit()); |
|
100 | - } |
|
101 | - return $io; |
|
102 | - } |
|
103 | - |
|
104 | - /** |
|
105 | - * @inheritDoc |
|
106 | - */ |
|
107 | - public function getClusterPools(): array |
|
108 | - { |
|
109 | - return $this->clusterPools; |
|
110 | - } |
|
111 | - |
|
112 | - /** |
|
113 | - * @inheritDoc |
|
114 | - */ |
|
115 | - public function getConfigs(): array |
|
116 | - { |
|
117 | - $configs = []; |
|
118 | - |
|
119 | - foreach ($this->getClusterPools() as $clusterPool) { |
|
120 | - $configs[$clusterPool->getDriverName()] = $clusterPool->getConfig(); |
|
121 | - } |
|
122 | - |
|
123 | - return $configs; |
|
124 | - } |
|
125 | - |
|
126 | - /** |
|
127 | - * @inheritDoc |
|
128 | - */ |
|
129 | - public function getItems(array $keys = []): iterable |
|
130 | - { |
|
131 | - $items = []; |
|
132 | - |
|
133 | - foreach ($keys as $key) { |
|
134 | - $items[$key] = $this->getItem($key); |
|
135 | - } |
|
136 | - |
|
137 | - return $items; |
|
138 | - } |
|
139 | - /** |
|
140 | - * Shared method used by All Clusters |
|
141 | - */ |
|
142 | - |
|
143 | - /** |
|
144 | - * @inheritDoc |
|
145 | - */ |
|
146 | - public function deleteItems(array $keys): bool |
|
147 | - { |
|
148 | - $hasDeletedOnce = false; |
|
149 | - foreach ($this->clusterPools as $driverPool) { |
|
150 | - if ($result = $driverPool->deleteItems($keys)) { |
|
151 | - $hasDeletedOnce = $result; |
|
152 | - } |
|
153 | - } |
|
154 | - // Return true only if at least one backend confirmed the "clear" operation |
|
155 | - return $hasDeletedOnce; |
|
156 | - } |
|
157 | - |
|
158 | - /** |
|
159 | - * @param CacheItemInterface $item |
|
160 | - * @return bool |
|
161 | - * @throws InvalidArgumentException |
|
162 | - * @throws PhpfastcacheLogicException |
|
163 | - */ |
|
164 | - public function saveDeferred(CacheItemInterface $item): bool |
|
165 | - { |
|
166 | - /** @var ExtendedCacheItemInterface $item */ |
|
167 | - $hasSavedOnce = false; |
|
168 | - foreach ($this->clusterPools as $driverPool) { |
|
169 | - $poolItem = $this->getStandardizedItem($item, $driverPool); |
|
170 | - if ($result = $driverPool->saveDeferred($poolItem)) { |
|
171 | - $hasSavedOnce = $result; |
|
172 | - } |
|
173 | - } |
|
174 | - // Return true only if at least one backend confirmed the "commit" operation |
|
175 | - return $hasSavedOnce; |
|
176 | - } |
|
177 | - |
|
178 | - /** |
|
179 | - * @param ExtendedCacheItemInterface $item |
|
180 | - * @param ExtendedCacheItemPoolInterface $driverPool |
|
181 | - * @return ExtendedCacheItemInterface |
|
182 | - * @throws InvalidArgumentException |
|
183 | - * @throws PhpfastcacheLogicException |
|
184 | - */ |
|
185 | - protected function getStandardizedItem(ExtendedCacheItemInterface $item, ExtendedCacheItemPoolInterface $driverPool): ExtendedCacheItemInterface |
|
186 | - { |
|
187 | - if (!$item->doesItemBelongToThatDriverBackend($driverPool)) { |
|
188 | - /** |
|
189 | - * Avoid infinite loop |
|
190 | - */ |
|
191 | - if ($driverPool === $this) { |
|
192 | - /** @var ExtendedCacheItemInterface $itemPool */ |
|
193 | - $itemClass = $driverPool::getItemClass(); |
|
194 | - $itemPool = new $itemClass($this, $item->getKey(), $this->getEventManager()); |
|
195 | - $item->cloneInto($itemPool, $driverPool); |
|
196 | - |
|
197 | - return $itemPool; |
|
198 | - } |
|
199 | - |
|
200 | - $itemPool = $driverPool->getItem($item->getKey()); |
|
201 | - $item->cloneInto($itemPool, $driverPool); |
|
202 | - |
|
203 | - return $itemPool; |
|
204 | - } |
|
205 | - |
|
206 | - return $item->setEventManager($this->getEventManager()); |
|
207 | - } |
|
208 | - |
|
209 | - /** |
|
210 | - * @return DriverStatistic |
|
211 | - */ |
|
212 | - public function getStats(): DriverStatistic |
|
213 | - { |
|
214 | - $stats = new DriverStatistic(); |
|
215 | - $stats->setInfo( |
|
216 | - sprintf( |
|
217 | - 'Using %d pool(s): %s', |
|
218 | - \count($this->clusterPools), |
|
219 | - \implode( |
|
220 | - ', ', |
|
221 | - \array_map( |
|
222 | - static fn (ExtendedCacheItemPoolInterface $pool) => \get_class($pool), |
|
223 | - $this->clusterPools |
|
224 | - ) |
|
225 | - ) |
|
226 | - ) |
|
227 | - ); |
|
228 | - |
|
229 | - $stats->setSize( |
|
230 | - (int)\array_sum( |
|
231 | - \array_map( |
|
232 | - static fn (ExtendedCacheItemPoolInterface $pool) => $pool->getStats()->getSize(), |
|
233 | - $this->clusterPools |
|
234 | - ) |
|
235 | - ) |
|
236 | - ); |
|
237 | - |
|
238 | - $stats->setData( |
|
239 | - \implode( |
|
240 | - ', ', |
|
241 | - \array_map( |
|
242 | - static fn (ExtendedCacheItemPoolInterface $pool) => $pool->getStats()->getData(), |
|
243 | - $this->clusterPools |
|
244 | - ) |
|
245 | - ) |
|
246 | - ); |
|
247 | - |
|
248 | - return $stats; |
|
249 | - } |
|
43 | + use TaggableCacheItemPoolTrait; |
|
44 | + use ClusterPoolTrait { |
|
45 | + TaggableCacheItemPoolTrait::__construct as private __parentConstruct; |
|
46 | + } |
|
47 | + |
|
48 | + public const STRATEGY = [ |
|
49 | + AggregatorInterface::STRATEGY_FULL_REPLICATION => FullReplicationCluster::class, |
|
50 | + AggregatorInterface::STRATEGY_SEMI_REPLICATION => SemiReplicationCluster::class, |
|
51 | + AggregatorInterface::STRATEGY_MASTER_SLAVE => MasterSlaveReplicationCluster::class, |
|
52 | + AggregatorInterface::STRATEGY_RANDOM_REPLICATION => RandomReplicationCluster::class, |
|
53 | + ]; |
|
54 | + |
|
55 | + /** |
|
56 | + * @var AggregatablePoolInterface[] |
|
57 | + */ |
|
58 | + protected array $clusterPools; |
|
59 | + |
|
60 | + /** |
|
61 | + * ClusterPoolAbstract constructor. |
|
62 | + * @param string $clusterName |
|
63 | + * @param EventManagerInterface $em |
|
64 | + * @param ExtendedCacheItemPoolInterface ...$driverPools |
|
65 | + * @throws PhpfastcacheDriverCheckException |
|
66 | + * @throws PhpfastcacheDriverConnectException |
|
67 | + * @throws PhpfastcacheInvalidArgumentException |
|
68 | + * @throws PhpfastcacheCoreException |
|
69 | + * @throws PhpfastcacheDriverException |
|
70 | + * @throws PhpfastcacheIOException |
|
71 | + */ |
|
72 | + public function __construct(string $clusterName, EventManagerInterface $em, AggregatablePoolInterface ...$driverPools) |
|
73 | + { |
|
74 | + if (count($driverPools) < 2) { |
|
75 | + throw new PhpfastcacheInvalidArgumentException('A cluster requires at least two pools to be working.'); |
|
76 | + } |
|
77 | + $this->clusterPools = $driverPools; |
|
78 | + $this->__parentConstruct(new ConfigurationOption(), $clusterName, $em); |
|
79 | + $this->setEventManager(EventManager::getInstance()); |
|
80 | + $this->setClusterPoolsAggregator(); |
|
81 | + } |
|
82 | + |
|
83 | + protected function setClusterPoolsAggregator(): void |
|
84 | + { |
|
85 | + foreach ($this->clusterPools as $clusterPool) { |
|
86 | + $clusterPool->setAggregatedBy($this); |
|
87 | + } |
|
88 | + } |
|
89 | + |
|
90 | + /** |
|
91 | + * @inheritDoc |
|
92 | + */ |
|
93 | + public function getIO(): DriverIO |
|
94 | + { |
|
95 | + $io = new DriverIO(); |
|
96 | + foreach ($this->clusterPools as $clusterPool) { |
|
97 | + $io->setReadHit($io->getReadHit() + $clusterPool->getIO()->getReadHit()) |
|
98 | + ->setReadMiss($io->getReadMiss() + $clusterPool->getIO()->getReadMiss()) |
|
99 | + ->setWriteHit($io->getWriteHit() + $clusterPool->getIO()->getWriteHit()); |
|
100 | + } |
|
101 | + return $io; |
|
102 | + } |
|
103 | + |
|
104 | + /** |
|
105 | + * @inheritDoc |
|
106 | + */ |
|
107 | + public function getClusterPools(): array |
|
108 | + { |
|
109 | + return $this->clusterPools; |
|
110 | + } |
|
111 | + |
|
112 | + /** |
|
113 | + * @inheritDoc |
|
114 | + */ |
|
115 | + public function getConfigs(): array |
|
116 | + { |
|
117 | + $configs = []; |
|
118 | + |
|
119 | + foreach ($this->getClusterPools() as $clusterPool) { |
|
120 | + $configs[$clusterPool->getDriverName()] = $clusterPool->getConfig(); |
|
121 | + } |
|
122 | + |
|
123 | + return $configs; |
|
124 | + } |
|
125 | + |
|
126 | + /** |
|
127 | + * @inheritDoc |
|
128 | + */ |
|
129 | + public function getItems(array $keys = []): iterable |
|
130 | + { |
|
131 | + $items = []; |
|
132 | + |
|
133 | + foreach ($keys as $key) { |
|
134 | + $items[$key] = $this->getItem($key); |
|
135 | + } |
|
136 | + |
|
137 | + return $items; |
|
138 | + } |
|
139 | + /** |
|
140 | + * Shared method used by All Clusters |
|
141 | + */ |
|
142 | + |
|
143 | + /** |
|
144 | + * @inheritDoc |
|
145 | + */ |
|
146 | + public function deleteItems(array $keys): bool |
|
147 | + { |
|
148 | + $hasDeletedOnce = false; |
|
149 | + foreach ($this->clusterPools as $driverPool) { |
|
150 | + if ($result = $driverPool->deleteItems($keys)) { |
|
151 | + $hasDeletedOnce = $result; |
|
152 | + } |
|
153 | + } |
|
154 | + // Return true only if at least one backend confirmed the "clear" operation |
|
155 | + return $hasDeletedOnce; |
|
156 | + } |
|
157 | + |
|
158 | + /** |
|
159 | + * @param CacheItemInterface $item |
|
160 | + * @return bool |
|
161 | + * @throws InvalidArgumentException |
|
162 | + * @throws PhpfastcacheLogicException |
|
163 | + */ |
|
164 | + public function saveDeferred(CacheItemInterface $item): bool |
|
165 | + { |
|
166 | + /** @var ExtendedCacheItemInterface $item */ |
|
167 | + $hasSavedOnce = false; |
|
168 | + foreach ($this->clusterPools as $driverPool) { |
|
169 | + $poolItem = $this->getStandardizedItem($item, $driverPool); |
|
170 | + if ($result = $driverPool->saveDeferred($poolItem)) { |
|
171 | + $hasSavedOnce = $result; |
|
172 | + } |
|
173 | + } |
|
174 | + // Return true only if at least one backend confirmed the "commit" operation |
|
175 | + return $hasSavedOnce; |
|
176 | + } |
|
177 | + |
|
178 | + /** |
|
179 | + * @param ExtendedCacheItemInterface $item |
|
180 | + * @param ExtendedCacheItemPoolInterface $driverPool |
|
181 | + * @return ExtendedCacheItemInterface |
|
182 | + * @throws InvalidArgumentException |
|
183 | + * @throws PhpfastcacheLogicException |
|
184 | + */ |
|
185 | + protected function getStandardizedItem(ExtendedCacheItemInterface $item, ExtendedCacheItemPoolInterface $driverPool): ExtendedCacheItemInterface |
|
186 | + { |
|
187 | + if (!$item->doesItemBelongToThatDriverBackend($driverPool)) { |
|
188 | + /** |
|
189 | + * Avoid infinite loop |
|
190 | + */ |
|
191 | + if ($driverPool === $this) { |
|
192 | + /** @var ExtendedCacheItemInterface $itemPool */ |
|
193 | + $itemClass = $driverPool::getItemClass(); |
|
194 | + $itemPool = new $itemClass($this, $item->getKey(), $this->getEventManager()); |
|
195 | + $item->cloneInto($itemPool, $driverPool); |
|
196 | + |
|
197 | + return $itemPool; |
|
198 | + } |
|
199 | + |
|
200 | + $itemPool = $driverPool->getItem($item->getKey()); |
|
201 | + $item->cloneInto($itemPool, $driverPool); |
|
202 | + |
|
203 | + return $itemPool; |
|
204 | + } |
|
205 | + |
|
206 | + return $item->setEventManager($this->getEventManager()); |
|
207 | + } |
|
208 | + |
|
209 | + /** |
|
210 | + * @return DriverStatistic |
|
211 | + */ |
|
212 | + public function getStats(): DriverStatistic |
|
213 | + { |
|
214 | + $stats = new DriverStatistic(); |
|
215 | + $stats->setInfo( |
|
216 | + sprintf( |
|
217 | + 'Using %d pool(s): %s', |
|
218 | + \count($this->clusterPools), |
|
219 | + \implode( |
|
220 | + ', ', |
|
221 | + \array_map( |
|
222 | + static fn (ExtendedCacheItemPoolInterface $pool) => \get_class($pool), |
|
223 | + $this->clusterPools |
|
224 | + ) |
|
225 | + ) |
|
226 | + ) |
|
227 | + ); |
|
228 | + |
|
229 | + $stats->setSize( |
|
230 | + (int)\array_sum( |
|
231 | + \array_map( |
|
232 | + static fn (ExtendedCacheItemPoolInterface $pool) => $pool->getStats()->getSize(), |
|
233 | + $this->clusterPools |
|
234 | + ) |
|
235 | + ) |
|
236 | + ); |
|
237 | + |
|
238 | + $stats->setData( |
|
239 | + \implode( |
|
240 | + ', ', |
|
241 | + \array_map( |
|
242 | + static fn (ExtendedCacheItemPoolInterface $pool) => $pool->getStats()->getData(), |
|
243 | + $this->clusterPools |
|
244 | + ) |
|
245 | + ) |
|
246 | + ); |
|
247 | + |
|
248 | + return $stats; |
|
249 | + } |
|
250 | 250 | } |
@@ -30,141 +30,141 @@ |
||
30 | 30 | |
31 | 31 | class ClusterAggregator implements AggregatorInterface |
32 | 32 | { |
33 | - /** |
|
34 | - * @var array<string, AggregatablePoolInterface> |
|
35 | - */ |
|
36 | - protected array $driverPools; |
|
37 | - |
|
38 | - protected ClusterPoolInterface $cluster; |
|
39 | - |
|
40 | - protected string $clusterAggregatorName; |
|
41 | - |
|
42 | - /** |
|
43 | - * ClusterAggregator constructor. |
|
44 | - * @param string $clusterAggregatorName |
|
45 | - * @param array<AggregatablePoolInterface> $driverPools |
|
46 | - * @throws PhpfastcacheLogicException |
|
47 | - */ |
|
48 | - public function __construct(string $clusterAggregatorName = '', AggregatablePoolInterface ...$driverPools) |
|
49 | - { |
|
50 | - $clusterAggregatorName = trim($clusterAggregatorName); |
|
51 | - if (empty($clusterAggregatorName)) { |
|
52 | - try { |
|
53 | - $clusterAggregatorName = 'cluster_' . \bin2hex(\random_bytes(15)); |
|
54 | - } catch (Exception) { |
|
55 | - $clusterAggregatorName = 'cluster_' . \str_shuffle(\spl_object_hash(new stdClass())); |
|
56 | - } |
|
57 | - } |
|
58 | - |
|
59 | - $this->clusterAggregatorName = $clusterAggregatorName; |
|
60 | - |
|
61 | - foreach ($driverPools as $driverPool) { |
|
62 | - $this->aggregateDriver($driverPool); |
|
63 | - } |
|
64 | - } |
|
65 | - |
|
66 | - /** |
|
67 | - * @param AggregatablePoolInterface $driverPool |
|
68 | - * |
|
69 | - * @throws PhpfastcacheLogicException |
|
70 | - */ |
|
71 | - public function aggregateDriver(AggregatablePoolInterface $driverPool): void |
|
72 | - { |
|
73 | - if (isset($this->cluster)) { |
|
74 | - throw new PhpfastcacheLogicException('The cluster has been already build, cannot aggregate more pools.'); |
|
75 | - } |
|
76 | - |
|
77 | - $splHash = \spl_object_hash($driverPool); |
|
78 | - if (!isset($this->driverPools[$splHash])) { |
|
79 | - if ($driverPool instanceof ClusterPoolInterface) { |
|
80 | - throw new PhpfastcacheLogicException('Recursive cluster aggregation is not allowed !'); |
|
81 | - } |
|
82 | - |
|
83 | - $this->driverPools[$splHash] = $driverPool; |
|
84 | - } else { |
|
85 | - throw new PhpfastcacheLogicException('This pool has been already aggregated !'); |
|
86 | - } |
|
87 | - } |
|
88 | - |
|
89 | - /** |
|
90 | - * @param string $driverName |
|
91 | - * @param ConfigurationOption|null $driverConfig |
|
92 | - * @throws PhpfastcacheDriverCheckException |
|
93 | - * @throws PhpfastcacheDriverException |
|
94 | - * @throws PhpfastcacheDriverNotFoundException |
|
95 | - * @throws PhpfastcacheLogicException |
|
96 | - */ |
|
97 | - public function aggregateDriverByName(string $driverName, ConfigurationOption $driverConfig = null): void |
|
98 | - { |
|
99 | - if (isset($this->cluster)) { |
|
100 | - throw new PhpfastcacheLogicException('The cluster has been already build, cannot aggregate more pools.'); |
|
101 | - } |
|
102 | - |
|
103 | - $driverInstance = CacheManager::getInstance($driverName, $driverConfig); |
|
104 | - |
|
105 | - if ($driverInstance instanceof AggregatablePoolInterface) { |
|
106 | - $this->aggregateDriver($driverInstance); |
|
107 | - } |
|
108 | - |
|
109 | - throw new PhpfastcacheDriverException( |
|
110 | - \sprintf( |
|
111 | - 'Driver "%s" does not implements "%s"', |
|
112 | - $driverInstance::class, |
|
113 | - AggregatablePoolInterface::class |
|
114 | - ) |
|
115 | - ); |
|
116 | - } |
|
117 | - |
|
118 | - /** |
|
119 | - * @param AggregatablePoolInterface $driverPool |
|
120 | - * |
|
121 | - * @throws PhpfastcacheLogicException |
|
122 | - */ |
|
123 | - public function disaggregateDriver(AggregatablePoolInterface $driverPool): void |
|
124 | - { |
|
125 | - if (isset($this->cluster)) { |
|
126 | - throw new PhpfastcacheLogicException('The cluster has been already build, cannot disaggregate pools.'); |
|
127 | - } |
|
128 | - |
|
129 | - $splHash = \spl_object_hash($driverPool); |
|
130 | - if (isset($this->driverPools[$splHash])) { |
|
131 | - unset($this->driverPools[$splHash]); |
|
132 | - } else { |
|
133 | - throw new PhpfastcacheLogicException('This pool was not aggregated !'); |
|
134 | - } |
|
135 | - } |
|
136 | - |
|
137 | - /** |
|
138 | - * @param int $strategy |
|
139 | - * |
|
140 | - * @return ClusterPoolInterface |
|
141 | - * @throws PhpfastcacheInvalidArgumentException |
|
142 | - */ |
|
143 | - public function getCluster(int $strategy = AggregatorInterface::STRATEGY_FULL_REPLICATION): ClusterPoolInterface |
|
144 | - { |
|
145 | - if (isset(ClusterPoolAbstract::STRATEGY[$strategy])) { |
|
146 | - if (!isset($this->cluster)) { |
|
147 | - $clusterClass = ClusterPoolAbstract::STRATEGY[$strategy]; |
|
148 | - $this->cluster = new $clusterClass( |
|
149 | - $this->getClusterAggregatorName(), |
|
150 | - EventManager::getInstance(), |
|
151 | - ...\array_values($this->driverPools) |
|
152 | - ); |
|
153 | - |
|
154 | - $this->cluster->getEventManager()->dispatch(Event::CACHE_CLUSTER_BUILT, $this, $this->cluster); |
|
155 | - } |
|
156 | - } else { |
|
157 | - throw new PhpfastcacheInvalidArgumentException('Unknown cluster strategy'); |
|
158 | - } |
|
159 | - |
|
160 | - return $this->cluster; |
|
161 | - } |
|
162 | - |
|
163 | - /** |
|
164 | - * @return string |
|
165 | - */ |
|
166 | - public function getClusterAggregatorName(): string |
|
167 | - { |
|
168 | - return $this->clusterAggregatorName; |
|
169 | - } |
|
33 | + /** |
|
34 | + * @var array<string, AggregatablePoolInterface> |
|
35 | + */ |
|
36 | + protected array $driverPools; |
|
37 | + |
|
38 | + protected ClusterPoolInterface $cluster; |
|
39 | + |
|
40 | + protected string $clusterAggregatorName; |
|
41 | + |
|
42 | + /** |
|
43 | + * ClusterAggregator constructor. |
|
44 | + * @param string $clusterAggregatorName |
|
45 | + * @param array<AggregatablePoolInterface> $driverPools |
|
46 | + * @throws PhpfastcacheLogicException |
|
47 | + */ |
|
48 | + public function __construct(string $clusterAggregatorName = '', AggregatablePoolInterface ...$driverPools) |
|
49 | + { |
|
50 | + $clusterAggregatorName = trim($clusterAggregatorName); |
|
51 | + if (empty($clusterAggregatorName)) { |
|
52 | + try { |
|
53 | + $clusterAggregatorName = 'cluster_' . \bin2hex(\random_bytes(15)); |
|
54 | + } catch (Exception) { |
|
55 | + $clusterAggregatorName = 'cluster_' . \str_shuffle(\spl_object_hash(new stdClass())); |
|
56 | + } |
|
57 | + } |
|
58 | + |
|
59 | + $this->clusterAggregatorName = $clusterAggregatorName; |
|
60 | + |
|
61 | + foreach ($driverPools as $driverPool) { |
|
62 | + $this->aggregateDriver($driverPool); |
|
63 | + } |
|
64 | + } |
|
65 | + |
|
66 | + /** |
|
67 | + * @param AggregatablePoolInterface $driverPool |
|
68 | + * |
|
69 | + * @throws PhpfastcacheLogicException |
|
70 | + */ |
|
71 | + public function aggregateDriver(AggregatablePoolInterface $driverPool): void |
|
72 | + { |
|
73 | + if (isset($this->cluster)) { |
|
74 | + throw new PhpfastcacheLogicException('The cluster has been already build, cannot aggregate more pools.'); |
|
75 | + } |
|
76 | + |
|
77 | + $splHash = \spl_object_hash($driverPool); |
|
78 | + if (!isset($this->driverPools[$splHash])) { |
|
79 | + if ($driverPool instanceof ClusterPoolInterface) { |
|
80 | + throw new PhpfastcacheLogicException('Recursive cluster aggregation is not allowed !'); |
|
81 | + } |
|
82 | + |
|
83 | + $this->driverPools[$splHash] = $driverPool; |
|
84 | + } else { |
|
85 | + throw new PhpfastcacheLogicException('This pool has been already aggregated !'); |
|
86 | + } |
|
87 | + } |
|
88 | + |
|
89 | + /** |
|
90 | + * @param string $driverName |
|
91 | + * @param ConfigurationOption|null $driverConfig |
|
92 | + * @throws PhpfastcacheDriverCheckException |
|
93 | + * @throws PhpfastcacheDriverException |
|
94 | + * @throws PhpfastcacheDriverNotFoundException |
|
95 | + * @throws PhpfastcacheLogicException |
|
96 | + */ |
|
97 | + public function aggregateDriverByName(string $driverName, ConfigurationOption $driverConfig = null): void |
|
98 | + { |
|
99 | + if (isset($this->cluster)) { |
|
100 | + throw new PhpfastcacheLogicException('The cluster has been already build, cannot aggregate more pools.'); |
|
101 | + } |
|
102 | + |
|
103 | + $driverInstance = CacheManager::getInstance($driverName, $driverConfig); |
|
104 | + |
|
105 | + if ($driverInstance instanceof AggregatablePoolInterface) { |
|
106 | + $this->aggregateDriver($driverInstance); |
|
107 | + } |
|
108 | + |
|
109 | + throw new PhpfastcacheDriverException( |
|
110 | + \sprintf( |
|
111 | + 'Driver "%s" does not implements "%s"', |
|
112 | + $driverInstance::class, |
|
113 | + AggregatablePoolInterface::class |
|
114 | + ) |
|
115 | + ); |
|
116 | + } |
|
117 | + |
|
118 | + /** |
|
119 | + * @param AggregatablePoolInterface $driverPool |
|
120 | + * |
|
121 | + * @throws PhpfastcacheLogicException |
|
122 | + */ |
|
123 | + public function disaggregateDriver(AggregatablePoolInterface $driverPool): void |
|
124 | + { |
|
125 | + if (isset($this->cluster)) { |
|
126 | + throw new PhpfastcacheLogicException('The cluster has been already build, cannot disaggregate pools.'); |
|
127 | + } |
|
128 | + |
|
129 | + $splHash = \spl_object_hash($driverPool); |
|
130 | + if (isset($this->driverPools[$splHash])) { |
|
131 | + unset($this->driverPools[$splHash]); |
|
132 | + } else { |
|
133 | + throw new PhpfastcacheLogicException('This pool was not aggregated !'); |
|
134 | + } |
|
135 | + } |
|
136 | + |
|
137 | + /** |
|
138 | + * @param int $strategy |
|
139 | + * |
|
140 | + * @return ClusterPoolInterface |
|
141 | + * @throws PhpfastcacheInvalidArgumentException |
|
142 | + */ |
|
143 | + public function getCluster(int $strategy = AggregatorInterface::STRATEGY_FULL_REPLICATION): ClusterPoolInterface |
|
144 | + { |
|
145 | + if (isset(ClusterPoolAbstract::STRATEGY[$strategy])) { |
|
146 | + if (!isset($this->cluster)) { |
|
147 | + $clusterClass = ClusterPoolAbstract::STRATEGY[$strategy]; |
|
148 | + $this->cluster = new $clusterClass( |
|
149 | + $this->getClusterAggregatorName(), |
|
150 | + EventManager::getInstance(), |
|
151 | + ...\array_values($this->driverPools) |
|
152 | + ); |
|
153 | + |
|
154 | + $this->cluster->getEventManager()->dispatch(Event::CACHE_CLUSTER_BUILT, $this, $this->cluster); |
|
155 | + } |
|
156 | + } else { |
|
157 | + throw new PhpfastcacheInvalidArgumentException('Unknown cluster strategy'); |
|
158 | + } |
|
159 | + |
|
160 | + return $this->cluster; |
|
161 | + } |
|
162 | + |
|
163 | + /** |
|
164 | + * @return string |
|
165 | + */ |
|
166 | + public function getClusterAggregatorName(): string |
|
167 | + { |
|
168 | + return $this->clusterAggregatorName; |
|
169 | + } |
|
170 | 170 | } |
@@ -21,13 +21,13 @@ |
||
21 | 21 | |
22 | 22 | interface ClusterPoolInterface extends ExtendedCacheItemPoolInterface |
23 | 23 | { |
24 | - /** |
|
25 | - * @return AggregatablePoolInterface[] |
|
26 | - */ |
|
27 | - public function getClusterPools(): array; |
|
24 | + /** |
|
25 | + * @return AggregatablePoolInterface[] |
|
26 | + */ |
|
27 | + public function getClusterPools(): array; |
|
28 | 28 | |
29 | - /** |
|
30 | - * @return ConfigurationOptionInterface[] |
|
31 | - */ |
|
32 | - public function getConfigs(): array; |
|
29 | + /** |
|
30 | + * @return ConfigurationOptionInterface[] |
|
31 | + */ |
|
32 | + public function getConfigs(): array; |
|
33 | 33 | } |
@@ -21,5 +21,5 @@ |
||
21 | 21 | |
22 | 22 | abstract class ItemAbstract implements ExtendedCacheItemInterface |
23 | 23 | { |
24 | - use TaggableCacheItemTrait; |
|
24 | + use TaggableCacheItemTrait; |
|
25 | 25 | } |
@@ -21,49 +21,49 @@ |
||
21 | 21 | |
22 | 22 | trait ClusterPoolTrait |
23 | 23 | { |
24 | - protected function driverCheck(): bool |
|
25 | - { |
|
26 | - return true; |
|
27 | - } |
|
24 | + protected function driverCheck(): bool |
|
25 | + { |
|
26 | + return true; |
|
27 | + } |
|
28 | 28 | |
29 | - protected function driverConnect(): bool |
|
30 | - { |
|
31 | - return true; |
|
32 | - } |
|
29 | + protected function driverConnect(): bool |
|
30 | + { |
|
31 | + return true; |
|
32 | + } |
|
33 | 33 | |
34 | - /** |
|
35 | - * @param ExtendedCacheItemInterface $item |
|
36 | - * @return ?array<string, mixed> |
|
37 | - */ |
|
38 | - protected function driverRead(ExtendedCacheItemInterface $item): ?array |
|
39 | - { |
|
40 | - return null; |
|
41 | - } |
|
34 | + /** |
|
35 | + * @param ExtendedCacheItemInterface $item |
|
36 | + * @return ?array<string, mixed> |
|
37 | + */ |
|
38 | + protected function driverRead(ExtendedCacheItemInterface $item): ?array |
|
39 | + { |
|
40 | + return null; |
|
41 | + } |
|
42 | 42 | |
43 | - /** |
|
44 | - * @param ExtendedCacheItemInterface $item |
|
45 | - * @return bool |
|
46 | - */ |
|
47 | - protected function driverWrite(ExtendedCacheItemInterface $item): bool |
|
48 | - { |
|
49 | - return true; |
|
50 | - } |
|
43 | + /** |
|
44 | + * @param ExtendedCacheItemInterface $item |
|
45 | + * @return bool |
|
46 | + */ |
|
47 | + protected function driverWrite(ExtendedCacheItemInterface $item): bool |
|
48 | + { |
|
49 | + return true; |
|
50 | + } |
|
51 | 51 | |
52 | - /** |
|
53 | - * @param string $key |
|
54 | - * @param string $encodedKey |
|
55 | - * @return bool |
|
56 | - */ |
|
57 | - protected function driverDelete(string $key, string $encodedKey): bool |
|
58 | - { |
|
59 | - return true; |
|
60 | - } |
|
52 | + /** |
|
53 | + * @param string $key |
|
54 | + * @param string $encodedKey |
|
55 | + * @return bool |
|
56 | + */ |
|
57 | + protected function driverDelete(string $key, string $encodedKey): bool |
|
58 | + { |
|
59 | + return true; |
|
60 | + } |
|
61 | 61 | |
62 | - /** |
|
63 | - * @return bool |
|
64 | - */ |
|
65 | - protected function driverClear(): bool |
|
66 | - { |
|
67 | - return true; |
|
68 | - } |
|
62 | + /** |
|
63 | + * @return bool |
|
64 | + */ |
|
65 | + protected function driverClear(): bool |
|
66 | + { |
|
67 | + return true; |
|
68 | + } |
|
69 | 69 | } |
@@ -20,37 +20,37 @@ |
||
20 | 20 | |
21 | 21 | class EventReferenceParameter |
22 | 22 | { |
23 | - public function __construct(protected mixed &$parameter, protected bool $allowTypeChange = false) |
|
24 | - { |
|
25 | - } |
|
26 | - |
|
27 | - public function getParameterValue(): mixed |
|
28 | - { |
|
29 | - return $this->parameter; |
|
30 | - } |
|
31 | - |
|
32 | - /** |
|
33 | - * @throws PhpfastcacheInvalidTypeException |
|
34 | - */ |
|
35 | - public function setParameterValue(mixed $newValue): void |
|
36 | - { |
|
37 | - if (!$this->allowTypeChange) { |
|
38 | - $currentType = \gettype($this->parameter); |
|
39 | - $newType = \gettype($newValue); |
|
40 | - if ($newType !== $currentType) { |
|
41 | - throw new PhpfastcacheInvalidTypeException(\sprintf( |
|
42 | - 'You tried to change the variable type from "%s" to "%s", which is not allowed.', |
|
43 | - $currentType, |
|
44 | - $newType |
|
45 | - )); |
|
46 | - } |
|
47 | - } |
|
48 | - |
|
49 | - $this->parameter = $newValue; |
|
50 | - } |
|
51 | - |
|
52 | - public function __invoke(): mixed |
|
53 | - { |
|
54 | - return $this->getParameterValue(); |
|
55 | - } |
|
23 | + public function __construct(protected mixed &$parameter, protected bool $allowTypeChange = false) |
|
24 | + { |
|
25 | + } |
|
26 | + |
|
27 | + public function getParameterValue(): mixed |
|
28 | + { |
|
29 | + return $this->parameter; |
|
30 | + } |
|
31 | + |
|
32 | + /** |
|
33 | + * @throws PhpfastcacheInvalidTypeException |
|
34 | + */ |
|
35 | + public function setParameterValue(mixed $newValue): void |
|
36 | + { |
|
37 | + if (!$this->allowTypeChange) { |
|
38 | + $currentType = \gettype($this->parameter); |
|
39 | + $newType = \gettype($newValue); |
|
40 | + if ($newType !== $currentType) { |
|
41 | + throw new PhpfastcacheInvalidTypeException(\sprintf( |
|
42 | + 'You tried to change the variable type from "%s" to "%s", which is not allowed.', |
|
43 | + $currentType, |
|
44 | + $newType |
|
45 | + )); |
|
46 | + } |
|
47 | + } |
|
48 | + |
|
49 | + $this->parameter = $newValue; |
|
50 | + } |
|
51 | + |
|
52 | + public function __invoke(): mixed |
|
53 | + { |
|
54 | + return $this->getParameterValue(); |
|
55 | + } |
|
56 | 56 | } |
@@ -18,34 +18,34 @@ |
||
18 | 18 | |
19 | 19 | trait EventManagerDispatcherTrait |
20 | 20 | { |
21 | - /** |
|
22 | - * @var EventManagerInterface |
|
23 | - */ |
|
24 | - protected EventManagerInterface $eventManager; |
|
21 | + /** |
|
22 | + * @var EventManagerInterface |
|
23 | + */ |
|
24 | + protected EventManagerInterface $eventManager; |
|
25 | 25 | /** |
26 | - * @return EventManagerInterface |
|
27 | - */ |
|
28 | - public function getEventManager(): EventManagerInterface |
|
29 | - { |
|
30 | - return $this->eventManager; |
|
31 | - } |
|
26 | + * @return EventManagerInterface |
|
27 | + */ |
|
28 | + public function getEventManager(): EventManagerInterface |
|
29 | + { |
|
30 | + return $this->eventManager; |
|
31 | + } |
|
32 | 32 | |
33 | - /** |
|
34 | - * @param EventManagerInterface $em |
|
35 | - * @return static |
|
36 | - */ |
|
37 | - public function setEventManager(EventManagerInterface $em): static |
|
38 | - { |
|
39 | - $this->eventManager = $em; |
|
40 | - return $this; |
|
41 | - } |
|
33 | + /** |
|
34 | + * @param EventManagerInterface $em |
|
35 | + * @return static |
|
36 | + */ |
|
37 | + public function setEventManager(EventManagerInterface $em): static |
|
38 | + { |
|
39 | + $this->eventManager = $em; |
|
40 | + return $this; |
|
41 | + } |
|
42 | 42 | |
43 | - /** |
|
44 | - * @deprecated Will be removed in v10 |
|
45 | - * @return bool |
|
46 | - */ |
|
47 | - public function hasEventManager(): bool |
|
48 | - { |
|
49 | - return isset($this->eventManager); |
|
50 | - } |
|
43 | + /** |
|
44 | + * @deprecated Will be removed in v10 |
|
45 | + * @return bool |
|
46 | + */ |
|
47 | + public function hasEventManager(): bool |
|
48 | + { |
|
49 | + return isset($this->eventManager); |
|
50 | + } |
|
51 | 51 | } |
@@ -20,31 +20,31 @@ |
||
20 | 20 | |
21 | 21 | class Event implements EventInterface |
22 | 22 | { |
23 | - use UninstanciableObjectTrait; |
|
23 | + use UninstanciableObjectTrait; |
|
24 | 24 | |
25 | - public const CACHE_GET_ITEM = 'CacheGetItem'; |
|
26 | - public const CACHE_GET_ITEMS = 'CacheGetItems'; |
|
27 | - public const CACHE_DELETE_ITEM = 'CacheDeleteItem'; |
|
28 | - public const CACHE_DELETE_ITEMS = 'CacheDeleteItems'; |
|
29 | - public const CACHE_SAVE_ITEM = 'CacheSaveItem'; |
|
30 | - public const CACHE_SAVE_MULTIPLE_ITEMS = 'CacheSaveMultipleItems'; |
|
31 | - public const CACHE_SAVE_DEFERRED_ITEM = 'CacheSaveDeferredItem'; |
|
32 | - public const CACHE_COMMIT_ITEM = 'CacheCommitItem'; |
|
33 | - public const CACHE_CLEAR_ITEM = 'CacheClearItem'; |
|
34 | - public const CACHE_WRITE_FILE_ON_DISK = 'CacheWriteFileOnDisk'; |
|
35 | - public const CACHE_GET_ITEM_IN_SLAM_BATCH = 'CacheGetItemInSlamBatch'; |
|
36 | - public const CACHE_REPLICATION_SLAVE_FALLBACK = 'CacheReplicationSlaveFallback'; |
|
37 | - public const CACHE_REPLICATION_RANDOM_POOL_CHOSEN = 'CacheReplicationRandomPoolChosen'; |
|
38 | - public const CACHE_CLUSTER_BUILT = 'CacheClusterBuilt'; |
|
39 | - public const CACHE_ITEM_SET = 'CacheItemSet'; |
|
40 | - public const CACHE_ITEM_EXPIRE_AT = 'CacheItemExpireAt'; |
|
41 | - public const CACHE_ITEM_EXPIRE_AFTER = 'CacheItemExpireAfter'; |
|
42 | - public const CACHE_GET_ALL_ITEMS = 'CacheGetAllItems'; |
|
43 | - public const CACHE_DRIVER_CHECKED = 'CacheDriverChecked'; |
|
44 | - public const CACHE_DRIVER_CONNECTED = 'CacheDriverConnected'; |
|
25 | + public const CACHE_GET_ITEM = 'CacheGetItem'; |
|
26 | + public const CACHE_GET_ITEMS = 'CacheGetItems'; |
|
27 | + public const CACHE_DELETE_ITEM = 'CacheDeleteItem'; |
|
28 | + public const CACHE_DELETE_ITEMS = 'CacheDeleteItems'; |
|
29 | + public const CACHE_SAVE_ITEM = 'CacheSaveItem'; |
|
30 | + public const CACHE_SAVE_MULTIPLE_ITEMS = 'CacheSaveMultipleItems'; |
|
31 | + public const CACHE_SAVE_DEFERRED_ITEM = 'CacheSaveDeferredItem'; |
|
32 | + public const CACHE_COMMIT_ITEM = 'CacheCommitItem'; |
|
33 | + public const CACHE_CLEAR_ITEM = 'CacheClearItem'; |
|
34 | + public const CACHE_WRITE_FILE_ON_DISK = 'CacheWriteFileOnDisk'; |
|
35 | + public const CACHE_GET_ITEM_IN_SLAM_BATCH = 'CacheGetItemInSlamBatch'; |
|
36 | + public const CACHE_REPLICATION_SLAVE_FALLBACK = 'CacheReplicationSlaveFallback'; |
|
37 | + public const CACHE_REPLICATION_RANDOM_POOL_CHOSEN = 'CacheReplicationRandomPoolChosen'; |
|
38 | + public const CACHE_CLUSTER_BUILT = 'CacheClusterBuilt'; |
|
39 | + public const CACHE_ITEM_SET = 'CacheItemSet'; |
|
40 | + public const CACHE_ITEM_EXPIRE_AT = 'CacheItemExpireAt'; |
|
41 | + public const CACHE_ITEM_EXPIRE_AFTER = 'CacheItemExpireAfter'; |
|
42 | + public const CACHE_GET_ALL_ITEMS = 'CacheGetAllItems'; |
|
43 | + public const CACHE_DRIVER_CHECKED = 'CacheDriverChecked'; |
|
44 | + public const CACHE_DRIVER_CONNECTED = 'CacheDriverConnected'; |
|
45 | 45 | |
46 | - public static function getEvents(): array |
|
47 | - { |
|
48 | - return (new \ReflectionClass(static::class))->getConstants(); |
|
49 | - } |
|
46 | + public static function getEvents(): array |
|
47 | + { |
|
48 | + return (new \ReflectionClass(static::class))->getConstants(); |
|
49 | + } |
|
50 | 50 | } |
@@ -54,65 +54,65 @@ |
||
54 | 54 | */ |
55 | 55 | interface EventManagerInterface |
56 | 56 | { |
57 | - /** |
|
58 | - * @return self |
|
59 | - */ |
|
60 | - public static function getInstance(): EventManagerInterface; |
|
57 | + /** |
|
58 | + * @return self |
|
59 | + */ |
|
60 | + public static function getInstance(): EventManagerInterface; |
|
61 | 61 | |
62 | - /** |
|
63 | - * @param EventManagerInterface $eventManagerInstance |
|
64 | - * @return void |
|
65 | - */ |
|
66 | - public static function setInstance(EventManagerInterface $eventManagerInstance): void; |
|
62 | + /** |
|
63 | + * @param EventManagerInterface $eventManagerInstance |
|
64 | + * @return void |
|
65 | + */ |
|
66 | + public static function setInstance(EventManagerInterface $eventManagerInstance): void; |
|
67 | 67 | |
68 | - /** |
|
69 | - * @param string $eventName |
|
70 | - * @param array<mixed> $args |
|
71 | - */ |
|
72 | - public function dispatch(string $eventName, ...$args): void; |
|
68 | + /** |
|
69 | + * @param string $eventName |
|
70 | + * @param array<mixed> $args |
|
71 | + */ |
|
72 | + public function dispatch(string $eventName, ...$args): void; |
|
73 | 73 | |
74 | - /** |
|
75 | - * @param string $name |
|
76 | - * @param array<mixed> $arguments |
|
77 | - * @throws PhpfastcacheInvalidArgumentException |
|
78 | - * @throws BadMethodCallException |
|
79 | - */ |
|
80 | - public function __call(string $name, array $arguments): void; |
|
74 | + /** |
|
75 | + * @param string $name |
|
76 | + * @param array<mixed> $arguments |
|
77 | + * @throws PhpfastcacheInvalidArgumentException |
|
78 | + * @throws BadMethodCallException |
|
79 | + */ |
|
80 | + public function __call(string $name, array $arguments): void; |
|
81 | 81 | |
82 | - /** |
|
83 | - * @param callable $callback |
|
84 | - * @param string $callbackName |
|
85 | - */ |
|
86 | - public function onEveryEvents(callable $callback, string $callbackName): void; |
|
82 | + /** |
|
83 | + * @param callable $callback |
|
84 | + * @param string $callbackName |
|
85 | + */ |
|
86 | + public function onEveryEvents(callable $callback, string $callbackName): void; |
|
87 | 87 | |
88 | - /** |
|
89 | - * @param string[]|string $events |
|
90 | - * @param callable $callback |
|
91 | - */ |
|
92 | - public function on(array|string $events, callable $callback): void; |
|
88 | + /** |
|
89 | + * @param string[]|string $events |
|
90 | + * @param callable $callback |
|
91 | + */ |
|
92 | + public function on(array|string $events, callable $callback): void; |
|
93 | 93 | |
94 | - /** |
|
95 | - * @param string $eventName |
|
96 | - * @param string $callbackName |
|
97 | - * @return bool |
|
98 | - */ |
|
99 | - public function unbindEventCallback(string $eventName, string $callbackName): bool; |
|
94 | + /** |
|
95 | + * @param string $eventName |
|
96 | + * @param string $callbackName |
|
97 | + * @return bool |
|
98 | + */ |
|
99 | + public function unbindEventCallback(string $eventName, string $callbackName): bool; |
|
100 | 100 | |
101 | - /** |
|
102 | - * @return bool |
|
103 | - */ |
|
104 | - public function unbindAllEventCallbacks(): bool; |
|
101 | + /** |
|
102 | + * @return bool |
|
103 | + */ |
|
104 | + public function unbindAllEventCallbacks(): bool; |
|
105 | 105 | |
106 | - /** |
|
107 | - * @param ExtendedCacheItemPoolInterface $pool |
|
108 | - * @return EventManagerInterface |
|
109 | - */ |
|
110 | - public function getScopedEventManager(ExtendedCacheItemPoolInterface $pool): EventManagerInterface; |
|
106 | + /** |
|
107 | + * @param ExtendedCacheItemPoolInterface $pool |
|
108 | + * @return EventManagerInterface |
|
109 | + */ |
|
110 | + public function getScopedEventManager(ExtendedCacheItemPoolInterface $pool): EventManagerInterface; |
|
111 | 111 | |
112 | - /** |
|
113 | - * @param ExtendedCacheItemPoolInterface $pool |
|
114 | - * @return EventManagerInterface |
|
115 | - * @throws PhpfastcacheEventManagerException |
|
116 | - */ |
|
117 | - public function setItemPoolContext(ExtendedCacheItemPoolInterface $pool): EventManagerInterface; |
|
112 | + /** |
|
113 | + * @param ExtendedCacheItemPoolInterface $pool |
|
114 | + * @return EventManagerInterface |
|
115 | + * @throws PhpfastcacheEventManagerException |
|
116 | + */ |
|
117 | + public function setItemPoolContext(ExtendedCacheItemPoolInterface $pool): EventManagerInterface; |
|
118 | 118 | } |