@@ -29,92 +29,92 @@ |
||
29 | 29 | */ |
30 | 30 | class Driver implements AggregatablePoolInterface |
31 | 31 | { |
32 | - use TaggableCacheItemPoolTrait; |
|
33 | - |
|
34 | - /** |
|
35 | - * @return bool |
|
36 | - */ |
|
37 | - public function driverCheck(): bool |
|
38 | - { |
|
39 | - return extension_loaded('Zend Data Cache') && function_exists('zend_disk_cache_store'); |
|
40 | - } |
|
41 | - |
|
42 | - /** |
|
43 | - * @return string |
|
44 | - */ |
|
45 | - public function getHelp(): string |
|
46 | - { |
|
47 | - return <<<HELP |
|
32 | + use TaggableCacheItemPoolTrait; |
|
33 | + |
|
34 | + /** |
|
35 | + * @return bool |
|
36 | + */ |
|
37 | + public function driverCheck(): bool |
|
38 | + { |
|
39 | + return extension_loaded('Zend Data Cache') && function_exists('zend_disk_cache_store'); |
|
40 | + } |
|
41 | + |
|
42 | + /** |
|
43 | + * @return string |
|
44 | + */ |
|
45 | + public function getHelp(): string |
|
46 | + { |
|
47 | + return <<<HELP |
|
48 | 48 | <p> |
49 | 49 | This driver rely on Zend Server 8.5+, see: https://www.zend.com/products/zend-server |
50 | 50 | </p> |
51 | 51 | HELP; |
52 | - } |
|
53 | - |
|
54 | - /** |
|
55 | - * @return DriverStatistic |
|
56 | - */ |
|
57 | - public function getStats(): DriverStatistic |
|
58 | - { |
|
59 | - $stat = new DriverStatistic(); |
|
60 | - $stat->setInfo('[ZendDisk] A void info string') |
|
61 | - ->setSize(0) |
|
62 | - ->setData(implode(', ', array_keys($this->itemInstances))) |
|
63 | - ->setRawData(false); |
|
64 | - |
|
65 | - return $stat; |
|
66 | - } |
|
67 | - |
|
68 | - /** |
|
69 | - * @return bool |
|
70 | - */ |
|
71 | - protected function driverConnect(): bool |
|
72 | - { |
|
73 | - return true; |
|
74 | - } |
|
75 | - |
|
76 | - /** |
|
77 | - * @param ExtendedCacheItemInterface $item |
|
78 | - * @return ?array<string, mixed> |
|
79 | - */ |
|
80 | - protected function driverRead(ExtendedCacheItemInterface $item): ?array |
|
81 | - { |
|
82 | - $data = zend_disk_cache_fetch($item->getKey()); |
|
83 | - |
|
84 | - if (empty($data) || !\is_array($data)) { |
|
85 | - return null; |
|
86 | - } |
|
87 | - |
|
88 | - return $data; |
|
89 | - } |
|
90 | - |
|
91 | - /** |
|
92 | - * @param ExtendedCacheItemInterface $item |
|
93 | - * @return mixed |
|
94 | - * @throws PhpfastcacheInvalidArgumentException |
|
95 | - */ |
|
96 | - protected function driverWrite(ExtendedCacheItemInterface $item): bool |
|
97 | - { |
|
98 | - |
|
99 | - $ttl = $item->getExpirationDate()->getTimestamp() - time(); |
|
100 | - |
|
101 | - return zend_disk_cache_store($item->getKey(), $this->driverPreWrap($item), ($ttl > 0 ? $ttl : 0)); |
|
102 | - } |
|
103 | - |
|
104 | - /** |
|
105 | - * @param string $key |
|
106 | - * @param string $encodedKey |
|
107 | - * @return bool |
|
108 | - */ |
|
109 | - protected function driverDelete(string $key, string $encodedKey): bool |
|
110 | - { |
|
111 | - |
|
112 | - return (bool)zend_disk_cache_delete($key); |
|
113 | - } |
|
114 | - |
|
115 | - |
|
116 | - protected function driverClear(): bool |
|
117 | - { |
|
118 | - return @zend_disk_cache_clear(); |
|
119 | - } |
|
52 | + } |
|
53 | + |
|
54 | + /** |
|
55 | + * @return DriverStatistic |
|
56 | + */ |
|
57 | + public function getStats(): DriverStatistic |
|
58 | + { |
|
59 | + $stat = new DriverStatistic(); |
|
60 | + $stat->setInfo('[ZendDisk] A void info string') |
|
61 | + ->setSize(0) |
|
62 | + ->setData(implode(', ', array_keys($this->itemInstances))) |
|
63 | + ->setRawData(false); |
|
64 | + |
|
65 | + return $stat; |
|
66 | + } |
|
67 | + |
|
68 | + /** |
|
69 | + * @return bool |
|
70 | + */ |
|
71 | + protected function driverConnect(): bool |
|
72 | + { |
|
73 | + return true; |
|
74 | + } |
|
75 | + |
|
76 | + /** |
|
77 | + * @param ExtendedCacheItemInterface $item |
|
78 | + * @return ?array<string, mixed> |
|
79 | + */ |
|
80 | + protected function driverRead(ExtendedCacheItemInterface $item): ?array |
|
81 | + { |
|
82 | + $data = zend_disk_cache_fetch($item->getKey()); |
|
83 | + |
|
84 | + if (empty($data) || !\is_array($data)) { |
|
85 | + return null; |
|
86 | + } |
|
87 | + |
|
88 | + return $data; |
|
89 | + } |
|
90 | + |
|
91 | + /** |
|
92 | + * @param ExtendedCacheItemInterface $item |
|
93 | + * @return mixed |
|
94 | + * @throws PhpfastcacheInvalidArgumentException |
|
95 | + */ |
|
96 | + protected function driverWrite(ExtendedCacheItemInterface $item): bool |
|
97 | + { |
|
98 | + |
|
99 | + $ttl = $item->getExpirationDate()->getTimestamp() - time(); |
|
100 | + |
|
101 | + return zend_disk_cache_store($item->getKey(), $this->driverPreWrap($item), ($ttl > 0 ? $ttl : 0)); |
|
102 | + } |
|
103 | + |
|
104 | + /** |
|
105 | + * @param string $key |
|
106 | + * @param string $encodedKey |
|
107 | + * @return bool |
|
108 | + */ |
|
109 | + protected function driverDelete(string $key, string $encodedKey): bool |
|
110 | + { |
|
111 | + |
|
112 | + return (bool)zend_disk_cache_delete($key); |
|
113 | + } |
|
114 | + |
|
115 | + |
|
116 | + protected function driverClear(): bool |
|
117 | + { |
|
118 | + return @zend_disk_cache_clear(); |
|
119 | + } |
|
120 | 120 | } |
@@ -109,7 +109,7 @@ |
||
109 | 109 | protected function driverDelete(string $key, string $encodedKey): bool |
110 | 110 | { |
111 | 111 | |
112 | - return (bool)zend_disk_cache_delete($key); |
|
112 | + return (bool) zend_disk_cache_delete($key); |
|
113 | 113 | } |
114 | 114 | |
115 | 115 |
@@ -32,104 +32,104 @@ |
||
32 | 32 | */ |
33 | 33 | class Driver implements AggregatablePoolInterface |
34 | 34 | { |
35 | - use IOHelperTrait; |
|
36 | - |
|
37 | - protected const LEVELDB_FILENAME = '.database'; |
|
38 | - |
|
39 | - /** |
|
40 | - * @return bool |
|
41 | - */ |
|
42 | - public function driverCheck(): bool |
|
43 | - { |
|
44 | - return extension_loaded('Leveldb'); |
|
45 | - } |
|
46 | - |
|
47 | - /** |
|
48 | - * Close connection on destruct |
|
49 | - */ |
|
50 | - public function __destruct() |
|
51 | - { |
|
52 | - if ($this->instance instanceof LeveldbClient) { |
|
53 | - $this->instance->close(); |
|
54 | - $this->instance = null; |
|
55 | - } |
|
56 | - } |
|
57 | - |
|
58 | - /** |
|
59 | - * @param ExtendedCacheItemInterface $item |
|
60 | - * @return ?array<string, mixed> |
|
61 | - */ |
|
62 | - protected function driverRead(ExtendedCacheItemInterface $item): ?array |
|
63 | - { |
|
64 | - $val = $this->instance->get($item->getKey()); |
|
65 | - if (!$val) { |
|
66 | - return null; |
|
67 | - } |
|
68 | - |
|
69 | - return $this->decode($val); |
|
70 | - } |
|
71 | - |
|
72 | - /** |
|
73 | - * @param ExtendedCacheItemInterface $item |
|
74 | - * @return bool |
|
75 | - * @throws PhpfastcacheInvalidArgumentException |
|
76 | - * @throws PhpfastcacheLogicException |
|
77 | - */ |
|
78 | - protected function driverWrite(ExtendedCacheItemInterface $item): bool |
|
79 | - { |
|
80 | - |
|
81 | - return (bool)$this->instance->set($item->getKey(), $this->encode($this->driverPreWrap($item))); |
|
82 | - } |
|
83 | - |
|
84 | - /** |
|
85 | - * @param string $key |
|
86 | - * @param string $encodedKey |
|
87 | - * @return bool |
|
88 | - */ |
|
89 | - protected function driverDelete(string $key, string $encodedKey): bool |
|
90 | - { |
|
91 | - return $this->instance->delete($key); |
|
92 | - } |
|
93 | - |
|
94 | - /** |
|
95 | - * @return bool |
|
96 | - * @throws PhpfastcacheCoreException |
|
97 | - * @throws PhpfastcacheLogicException |
|
98 | - */ |
|
99 | - protected function driverClear(): bool |
|
100 | - { |
|
101 | - if ($this->instance instanceof LeveldbClient) { |
|
102 | - $this->instance->close(); |
|
103 | - $this->instance = null; |
|
104 | - } |
|
105 | - $result = LeveldbClient::destroy($this->getLeveldbFile()); |
|
106 | - $this->driverConnect(); |
|
107 | - |
|
108 | - return $result; |
|
109 | - } |
|
110 | - |
|
111 | - /** |
|
112 | - * @return string |
|
113 | - * @throws PhpfastcacheCoreException |
|
114 | - */ |
|
115 | - public function getLeveldbFile(): string |
|
116 | - { |
|
117 | - return $this->getPath() . '/' . self::LEVELDB_FILENAME; |
|
118 | - } |
|
119 | - |
|
120 | - /** |
|
121 | - * @return bool |
|
122 | - * @throws PhpfastcacheCoreException |
|
123 | - * @throws PhpfastcacheLogicException |
|
124 | - */ |
|
125 | - protected function driverConnect(): bool |
|
126 | - { |
|
127 | - if ($this->instance instanceof LeveldbClient) { |
|
128 | - throw new PhpfastcacheLogicException('Already connected to Leveldb database'); |
|
129 | - } |
|
130 | - |
|
131 | - $this->instance = new LeveldbClient($this->getLeveldbFile()); |
|
132 | - |
|
133 | - return true; |
|
134 | - } |
|
35 | + use IOHelperTrait; |
|
36 | + |
|
37 | + protected const LEVELDB_FILENAME = '.database'; |
|
38 | + |
|
39 | + /** |
|
40 | + * @return bool |
|
41 | + */ |
|
42 | + public function driverCheck(): bool |
|
43 | + { |
|
44 | + return extension_loaded('Leveldb'); |
|
45 | + } |
|
46 | + |
|
47 | + /** |
|
48 | + * Close connection on destruct |
|
49 | + */ |
|
50 | + public function __destruct() |
|
51 | + { |
|
52 | + if ($this->instance instanceof LeveldbClient) { |
|
53 | + $this->instance->close(); |
|
54 | + $this->instance = null; |
|
55 | + } |
|
56 | + } |
|
57 | + |
|
58 | + /** |
|
59 | + * @param ExtendedCacheItemInterface $item |
|
60 | + * @return ?array<string, mixed> |
|
61 | + */ |
|
62 | + protected function driverRead(ExtendedCacheItemInterface $item): ?array |
|
63 | + { |
|
64 | + $val = $this->instance->get($item->getKey()); |
|
65 | + if (!$val) { |
|
66 | + return null; |
|
67 | + } |
|
68 | + |
|
69 | + return $this->decode($val); |
|
70 | + } |
|
71 | + |
|
72 | + /** |
|
73 | + * @param ExtendedCacheItemInterface $item |
|
74 | + * @return bool |
|
75 | + * @throws PhpfastcacheInvalidArgumentException |
|
76 | + * @throws PhpfastcacheLogicException |
|
77 | + */ |
|
78 | + protected function driverWrite(ExtendedCacheItemInterface $item): bool |
|
79 | + { |
|
80 | + |
|
81 | + return (bool)$this->instance->set($item->getKey(), $this->encode($this->driverPreWrap($item))); |
|
82 | + } |
|
83 | + |
|
84 | + /** |
|
85 | + * @param string $key |
|
86 | + * @param string $encodedKey |
|
87 | + * @return bool |
|
88 | + */ |
|
89 | + protected function driverDelete(string $key, string $encodedKey): bool |
|
90 | + { |
|
91 | + return $this->instance->delete($key); |
|
92 | + } |
|
93 | + |
|
94 | + /** |
|
95 | + * @return bool |
|
96 | + * @throws PhpfastcacheCoreException |
|
97 | + * @throws PhpfastcacheLogicException |
|
98 | + */ |
|
99 | + protected function driverClear(): bool |
|
100 | + { |
|
101 | + if ($this->instance instanceof LeveldbClient) { |
|
102 | + $this->instance->close(); |
|
103 | + $this->instance = null; |
|
104 | + } |
|
105 | + $result = LeveldbClient::destroy($this->getLeveldbFile()); |
|
106 | + $this->driverConnect(); |
|
107 | + |
|
108 | + return $result; |
|
109 | + } |
|
110 | + |
|
111 | + /** |
|
112 | + * @return string |
|
113 | + * @throws PhpfastcacheCoreException |
|
114 | + */ |
|
115 | + public function getLeveldbFile(): string |
|
116 | + { |
|
117 | + return $this->getPath() . '/' . self::LEVELDB_FILENAME; |
|
118 | + } |
|
119 | + |
|
120 | + /** |
|
121 | + * @return bool |
|
122 | + * @throws PhpfastcacheCoreException |
|
123 | + * @throws PhpfastcacheLogicException |
|
124 | + */ |
|
125 | + protected function driverConnect(): bool |
|
126 | + { |
|
127 | + if ($this->instance instanceof LeveldbClient) { |
|
128 | + throw new PhpfastcacheLogicException('Already connected to Leveldb database'); |
|
129 | + } |
|
130 | + |
|
131 | + $this->instance = new LeveldbClient($this->getLeveldbFile()); |
|
132 | + |
|
133 | + return true; |
|
134 | + } |
|
135 | 135 | } |
@@ -78,7 +78,7 @@ |
||
78 | 78 | protected function driverWrite(ExtendedCacheItemInterface $item): bool |
79 | 79 | { |
80 | 80 | |
81 | - return (bool)$this->instance->set($item->getKey(), $this->encode($this->driverPreWrap($item))); |
|
81 | + return (bool) $this->instance->set($item->getKey(), $this->encode($this->driverPreWrap($item))); |
|
82 | 82 | } |
83 | 83 | |
84 | 84 | /** |
@@ -47,8 +47,7 @@ |
||
47 | 47 | /** |
48 | 48 | * Close connection on destruct |
49 | 49 | */ |
50 | - public function __destruct() |
|
51 | - { |
|
50 | + public function __destruct() { |
|
52 | 51 | if ($this->instance instanceof LeveldbClient) { |
53 | 52 | $this->instance->close(); |
54 | 53 | $this->instance = null; |
@@ -25,9 +25,9 @@ |
||
25 | 25 | */ |
26 | 26 | class Item extends \Phpfastcache\Drivers\Memory\Item |
27 | 27 | { |
28 | - public function __construct(ExtendedCacheItemPoolInterface $driver, string $key, EventManagerInterface $em) |
|
29 | - { |
|
30 | - trigger_error('Memstatic driver has changed its name, it is now called "Memory"', E_USER_DEPRECATED); |
|
31 | - parent::__construct($driver, $key, $em); |
|
32 | - } |
|
28 | + public function __construct(ExtendedCacheItemPoolInterface $driver, string $key, EventManagerInterface $em) |
|
29 | + { |
|
30 | + trigger_error('Memstatic driver has changed its name, it is now called "Memory"', E_USER_DEPRECATED); |
|
31 | + parent::__construct($driver, $key, $em); |
|
32 | + } |
|
33 | 33 | } |
@@ -25,8 +25,7 @@ |
||
25 | 25 | */ |
26 | 26 | class Item extends \Phpfastcache\Drivers\Memory\Item |
27 | 27 | { |
28 | - public function __construct(ExtendedCacheItemPoolInterface $driver, string $key, EventManagerInterface $em) |
|
29 | - { |
|
28 | + public function __construct(ExtendedCacheItemPoolInterface $driver, string $key, EventManagerInterface $em) { |
|
30 | 29 | trigger_error('Memstatic driver has changed its name, it is now called "Memory"', E_USER_DEPRECATED); |
31 | 30 | parent::__construct($driver, $key, $em); |
32 | 31 | } |
@@ -25,9 +25,9 @@ |
||
25 | 25 | */ |
26 | 26 | class Driver extends \Phpfastcache\Drivers\Memory\Driver |
27 | 27 | { |
28 | - public function __construct(#[\SensitiveParameter] ConfigurationOptionInterface $config, string $instanceId, EventManagerInterface $em) |
|
29 | - { |
|
30 | - trigger_error('Memstatic driver has changed its name, it is now called "Memory"', E_USER_DEPRECATED); |
|
31 | - parent::__construct($config, $instanceId, $em); |
|
32 | - } |
|
28 | + public function __construct(#[\SensitiveParameter] ConfigurationOptionInterface $config, string $instanceId, EventManagerInterface $em) |
|
29 | + { |
|
30 | + trigger_error('Memstatic driver has changed its name, it is now called "Memory"', E_USER_DEPRECATED); |
|
31 | + parent::__construct($config, $instanceId, $em); |
|
32 | + } |
|
33 | 33 | } |
@@ -25,8 +25,7 @@ |
||
25 | 25 | */ |
26 | 26 | class Driver extends \Phpfastcache\Drivers\Memory\Driver |
27 | 27 | { |
28 | - public function __construct(#[\SensitiveParameter] ConfigurationOptionInterface $config, string $instanceId, EventManagerInterface $em) |
|
29 | - { |
|
28 | + public function __construct(#[\SensitiveParameter] ConfigurationOptionInterface $config, string $instanceId, EventManagerInterface $em) { |
|
30 | 29 | trigger_error('Memstatic driver has changed its name, it is now called "Memory"', E_USER_DEPRECATED); |
31 | 30 | parent::__construct($config, $instanceId, $em); |
32 | 31 | } |
@@ -22,9 +22,9 @@ |
||
22 | 22 | */ |
23 | 23 | class Config extends \Phpfastcache\Drivers\Memory\Config |
24 | 24 | { |
25 | - public function __construct(array $parameters = []) |
|
26 | - { |
|
27 | - trigger_error('Memstatic driver has changed its name, it is now called "Memory"', E_USER_DEPRECATED); |
|
28 | - parent::__construct($parameters); |
|
29 | - } |
|
25 | + public function __construct(array $parameters = []) |
|
26 | + { |
|
27 | + trigger_error('Memstatic driver has changed its name, it is now called "Memory"', E_USER_DEPRECATED); |
|
28 | + parent::__construct($parameters); |
|
29 | + } |
|
30 | 30 | } |
@@ -22,8 +22,7 @@ |
||
22 | 22 | */ |
23 | 23 | class Config extends \Phpfastcache\Drivers\Memory\Config |
24 | 24 | { |
25 | - public function __construct(array $parameters = []) |
|
26 | - { |
|
25 | + public function __construct(array $parameters = []) { |
|
27 | 26 | trigger_error('Memstatic driver has changed its name, it is now called "Memory"', E_USER_DEPRECATED); |
28 | 27 | parent::__construct($parameters); |
29 | 28 | } |
@@ -31,123 +31,123 @@ |
||
31 | 31 | */ |
32 | 32 | class Driver implements AggregatablePoolInterface |
33 | 33 | { |
34 | - use RedisDriverTrait, TaggableCacheItemPoolTrait { |
|
35 | - RedisDriverTrait::driverReadMultiple insteadof TaggableCacheItemPoolTrait; |
|
36 | - RedisDriverTrait::driverDeleteMultiple insteadof TaggableCacheItemPoolTrait; |
|
37 | - } |
|
38 | - |
|
39 | - /** |
|
40 | - * @return bool |
|
41 | - */ |
|
42 | - public function driverCheck(): bool |
|
43 | - { |
|
44 | - return extension_loaded('Redis') && class_exists(RedisCluster::class); |
|
45 | - } |
|
46 | - |
|
47 | - /** |
|
48 | - * @return DriverStatistic |
|
49 | - */ |
|
50 | - public function getStats(): DriverStatistic |
|
51 | - { |
|
52 | - $masters = $this->instance->_masters(); |
|
53 | - $infos = array_map(fn($cluster) => $this->instance->info($cluster), $masters); |
|
54 | - $date = (new DateTime())->setTimestamp(time() - min(array_column($infos, 'uptime_in_seconds'))); |
|
55 | - |
|
56 | - return (new DriverStatistic()) |
|
57 | - ->setData(implode(', ', array_keys($this->itemInstances))) |
|
58 | - ->setRawData($infos) |
|
59 | - ->setSize(array_sum(array_column($infos, 'used_memory_dataset'))) |
|
60 | - ->setInfo( |
|
61 | - sprintf( |
|
62 | - trim(<<<EOF |
|
34 | + use RedisDriverTrait, TaggableCacheItemPoolTrait { |
|
35 | + RedisDriverTrait::driverReadMultiple insteadof TaggableCacheItemPoolTrait; |
|
36 | + RedisDriverTrait::driverDeleteMultiple insteadof TaggableCacheItemPoolTrait; |
|
37 | + } |
|
38 | + |
|
39 | + /** |
|
40 | + * @return bool |
|
41 | + */ |
|
42 | + public function driverCheck(): bool |
|
43 | + { |
|
44 | + return extension_loaded('Redis') && class_exists(RedisCluster::class); |
|
45 | + } |
|
46 | + |
|
47 | + /** |
|
48 | + * @return DriverStatistic |
|
49 | + */ |
|
50 | + public function getStats(): DriverStatistic |
|
51 | + { |
|
52 | + $masters = $this->instance->_masters(); |
|
53 | + $infos = array_map(fn($cluster) => $this->instance->info($cluster), $masters); |
|
54 | + $date = (new DateTime())->setTimestamp(time() - min(array_column($infos, 'uptime_in_seconds'))); |
|
55 | + |
|
56 | + return (new DriverStatistic()) |
|
57 | + ->setData(implode(', ', array_keys($this->itemInstances))) |
|
58 | + ->setRawData($infos) |
|
59 | + ->setSize(array_sum(array_column($infos, 'used_memory_dataset'))) |
|
60 | + ->setInfo( |
|
61 | + sprintf( |
|
62 | + trim(<<<EOF |
|
63 | 63 | Redis Cluster version v%s, php-ext v%s with %d master nodes and %d slaves connected are up since %s. |
64 | 64 | For more information see RawData. |
65 | 65 | EOF), |
66 | - implode(', ', array_unique(array_column($infos, 'redis_version'))), |
|
67 | - \phpversion("redis"), |
|
68 | - count($masters), |
|
69 | - array_sum(array_column($infos, 'connected_slaves')), |
|
70 | - $date->format(DATE_RFC2822) |
|
71 | - ) |
|
72 | - ); |
|
73 | - } |
|
74 | - |
|
75 | - /** |
|
76 | - * @return bool |
|
77 | - * @throws PhpfastcacheLogicException |
|
78 | - */ |
|
79 | - protected function driverConnect(): bool |
|
80 | - { |
|
81 | - if (isset($this->instance) && $this->instance instanceof RedisCluster) { |
|
82 | - throw new PhpfastcacheLogicException('Already connected to Redis server'); |
|
83 | - } |
|
84 | - |
|
85 | - /** |
|
86 | - * In case of a user-provided |
|
87 | - * Redis client just return here |
|
88 | - */ |
|
89 | - if ($this->getConfig()->getRedisClusterClient() instanceof RedisCluster) { |
|
90 | - /** |
|
91 | - * Unlike Predis, we can't test if we're connected |
|
92 | - * or not, so let's just assume that we are |
|
93 | - */ |
|
94 | - $this->instance = $this->getConfig()->getRedisClusterClient(); |
|
95 | - return true; |
|
96 | - } |
|
97 | - |
|
98 | - $this->instance = $this->instance ?? new RedisCluster( |
|
99 | - null, |
|
100 | - $this->getConfig()->getClusters(), |
|
101 | - $this->getConfig()->getTimeout(), |
|
102 | - $this->getConfig()->getReadTimeout(), |
|
103 | - true, |
|
104 | - $this->getConfig()->getPassword() |
|
105 | - ); |
|
106 | - |
|
107 | - $this->instance->setOption(RedisCluster::OPT_SCAN, RedisCluster::SCAN_RETRY); |
|
108 | - |
|
109 | - if ($this->getConfig()->getOptPrefix()) { |
|
110 | - $this->instance->setOption(RedisCluster::OPT_PREFIX, $this->getConfig()->getOptPrefix()); |
|
111 | - } |
|
112 | - |
|
113 | - if ($this->getConfig()->getSlaveFailover()) { |
|
114 | - $this->instance->setOption(RedisCluster::OPT_SLAVE_FAILOVER, $this->getConfig()->getSlaveFailover()); |
|
115 | - } |
|
116 | - |
|
117 | - |
|
118 | - return true; |
|
119 | - } |
|
120 | - |
|
121 | - /** |
|
122 | - * @return array<int, string> |
|
123 | - */ |
|
124 | - protected function driverReadAllKeys(string $pattern = '*'): iterable |
|
125 | - { |
|
126 | - $keys = [[]]; |
|
127 | - foreach ($this->instance->_masters() as $master) { |
|
128 | - $i = -1; |
|
129 | - $result = $this->instance->scan( |
|
130 | - $i, |
|
131 | - $master, |
|
132 | - $pattern === '' ? '*' : $pattern, |
|
133 | - ExtendedCacheItemPoolInterface::MAX_ALL_KEYS_COUNT |
|
134 | - ); |
|
135 | - if (is_array($result)) { |
|
136 | - $keys[] = $result; |
|
137 | - } |
|
138 | - } |
|
139 | - |
|
140 | - return array_unique(array_merge(...$keys)); |
|
141 | - } |
|
142 | - |
|
143 | - /** |
|
144 | - * @return bool |
|
145 | - */ |
|
146 | - protected function driverClear(): bool |
|
147 | - { |
|
148 | - foreach ($this->instance->_masters() as $nodeMaster) { |
|
149 | - $this->instance->flushDb($nodeMaster); |
|
150 | - } |
|
151 | - return true; |
|
152 | - } |
|
66 | + implode(', ', array_unique(array_column($infos, 'redis_version'))), |
|
67 | + \phpversion("redis"), |
|
68 | + count($masters), |
|
69 | + array_sum(array_column($infos, 'connected_slaves')), |
|
70 | + $date->format(DATE_RFC2822) |
|
71 | + ) |
|
72 | + ); |
|
73 | + } |
|
74 | + |
|
75 | + /** |
|
76 | + * @return bool |
|
77 | + * @throws PhpfastcacheLogicException |
|
78 | + */ |
|
79 | + protected function driverConnect(): bool |
|
80 | + { |
|
81 | + if (isset($this->instance) && $this->instance instanceof RedisCluster) { |
|
82 | + throw new PhpfastcacheLogicException('Already connected to Redis server'); |
|
83 | + } |
|
84 | + |
|
85 | + /** |
|
86 | + * In case of a user-provided |
|
87 | + * Redis client just return here |
|
88 | + */ |
|
89 | + if ($this->getConfig()->getRedisClusterClient() instanceof RedisCluster) { |
|
90 | + /** |
|
91 | + * Unlike Predis, we can't test if we're connected |
|
92 | + * or not, so let's just assume that we are |
|
93 | + */ |
|
94 | + $this->instance = $this->getConfig()->getRedisClusterClient(); |
|
95 | + return true; |
|
96 | + } |
|
97 | + |
|
98 | + $this->instance = $this->instance ?? new RedisCluster( |
|
99 | + null, |
|
100 | + $this->getConfig()->getClusters(), |
|
101 | + $this->getConfig()->getTimeout(), |
|
102 | + $this->getConfig()->getReadTimeout(), |
|
103 | + true, |
|
104 | + $this->getConfig()->getPassword() |
|
105 | + ); |
|
106 | + |
|
107 | + $this->instance->setOption(RedisCluster::OPT_SCAN, RedisCluster::SCAN_RETRY); |
|
108 | + |
|
109 | + if ($this->getConfig()->getOptPrefix()) { |
|
110 | + $this->instance->setOption(RedisCluster::OPT_PREFIX, $this->getConfig()->getOptPrefix()); |
|
111 | + } |
|
112 | + |
|
113 | + if ($this->getConfig()->getSlaveFailover()) { |
|
114 | + $this->instance->setOption(RedisCluster::OPT_SLAVE_FAILOVER, $this->getConfig()->getSlaveFailover()); |
|
115 | + } |
|
116 | + |
|
117 | + |
|
118 | + return true; |
|
119 | + } |
|
120 | + |
|
121 | + /** |
|
122 | + * @return array<int, string> |
|
123 | + */ |
|
124 | + protected function driverReadAllKeys(string $pattern = '*'): iterable |
|
125 | + { |
|
126 | + $keys = [[]]; |
|
127 | + foreach ($this->instance->_masters() as $master) { |
|
128 | + $i = -1; |
|
129 | + $result = $this->instance->scan( |
|
130 | + $i, |
|
131 | + $master, |
|
132 | + $pattern === '' ? '*' : $pattern, |
|
133 | + ExtendedCacheItemPoolInterface::MAX_ALL_KEYS_COUNT |
|
134 | + ); |
|
135 | + if (is_array($result)) { |
|
136 | + $keys[] = $result; |
|
137 | + } |
|
138 | + } |
|
139 | + |
|
140 | + return array_unique(array_merge(...$keys)); |
|
141 | + } |
|
142 | + |
|
143 | + /** |
|
144 | + * @return bool |
|
145 | + */ |
|
146 | + protected function driverClear(): bool |
|
147 | + { |
|
148 | + foreach ($this->instance->_masters() as $nodeMaster) { |
|
149 | + $this->instance->flushDb($nodeMaster); |
|
150 | + } |
|
151 | + return true; |
|
152 | + } |
|
153 | 153 | } |
@@ -23,164 +23,164 @@ |
||
23 | 23 | |
24 | 24 | class Config extends ConfigurationOption |
25 | 25 | { |
26 | - /** |
|
27 | - * @var array<string> |
|
28 | - */ |
|
29 | - protected array $clusters = []; |
|
30 | - protected string $password = ''; |
|
31 | - protected int $timeout = 5; |
|
32 | - protected int $readTimeout = 5; |
|
33 | - protected ?RedisClusterClient $redisClusterClient = null; |
|
34 | - protected string $optPrefix = ''; |
|
35 | - protected ?int $slaveFailover = null; |
|
36 | - |
|
37 | - /** |
|
38 | - * @return array<string> |
|
39 | - */ |
|
40 | - public function getClusters(): array |
|
41 | - { |
|
42 | - return $this->clusters; |
|
43 | - } |
|
44 | - |
|
45 | - /** |
|
46 | - * @param string $cluster |
|
47 | - * @return Config |
|
48 | - */ |
|
49 | - public function addCluster(string $cluster): static |
|
50 | - { |
|
51 | - $this->enforceLockedProperty(__FUNCTION__); |
|
52 | - $this->clusters[] = $cluster; |
|
53 | - return $this; |
|
54 | - } |
|
55 | - |
|
56 | - /** |
|
57 | - * @param string $clusters |
|
58 | - * @return Config |
|
59 | - */ |
|
60 | - public function setClusters(...$clusters): static |
|
61 | - { |
|
62 | - return $this->setProperty('clusters', $clusters); |
|
63 | - } |
|
64 | - |
|
65 | - /** |
|
66 | - * @return string |
|
67 | - */ |
|
68 | - public function getPassword(): string |
|
69 | - { |
|
70 | - return $this->password; |
|
71 | - } |
|
72 | - |
|
73 | - /** |
|
74 | - * @param string $password |
|
75 | - * |
|
76 | - * @return static |
|
77 | - * @throws PhpfastcacheLogicException |
|
78 | - */ |
|
79 | - public function setPassword(string $password): static |
|
80 | - { |
|
81 | - return $this->setProperty('password', $password); |
|
82 | - } |
|
83 | - |
|
84 | - /** |
|
85 | - * @return int |
|
86 | - */ |
|
87 | - public function getTimeout(): int |
|
88 | - { |
|
89 | - return $this->timeout; |
|
90 | - } |
|
91 | - |
|
92 | - /** |
|
93 | - * @param int $timeout |
|
94 | - * @return static |
|
95 | - * @throws PhpfastcacheLogicException |
|
96 | - */ |
|
97 | - public function setTimeout(int $timeout): static |
|
98 | - { |
|
99 | - return $this->setProperty('timeout', $timeout); |
|
100 | - } |
|
101 | - |
|
102 | - /** |
|
103 | - * @return int |
|
104 | - */ |
|
105 | - public function getReadTimeout(): int |
|
106 | - { |
|
107 | - return $this->readTimeout; |
|
108 | - } |
|
109 | - |
|
110 | - /** |
|
111 | - * @param int $readTimeout |
|
112 | - * @return static |
|
113 | - * @throws PhpfastcacheLogicException |
|
114 | - */ |
|
115 | - public function setReadTimeout(int $readTimeout): static |
|
116 | - { |
|
117 | - return $this->setProperty('readTimeout', $readTimeout); |
|
118 | - } |
|
119 | - |
|
120 | - |
|
121 | - /** |
|
122 | - * @return RedisClusterClient|null |
|
123 | - */ |
|
124 | - public function getRedisClusterClient(): ?RedisClusterClient |
|
125 | - { |
|
126 | - return $this->redisClusterClient; |
|
127 | - } |
|
128 | - |
|
129 | - /** |
|
130 | - * @param RedisClusterClient|null $redisClusterClient |
|
131 | - * @return Config |
|
132 | - * @throws PhpfastcacheLogicException |
|
133 | - */ |
|
134 | - public function setRedisClusterClient(?RedisClusterClient $redisClusterClient): static |
|
135 | - { |
|
136 | - return $this->setProperty('redisClusterClient', $redisClusterClient); |
|
137 | - } |
|
138 | - |
|
139 | - /** |
|
140 | - * @return string |
|
141 | - * @since 7.0.2 |
|
142 | - */ |
|
143 | - public function getOptPrefix(): string |
|
144 | - { |
|
145 | - return $this->optPrefix; |
|
146 | - } |
|
147 | - |
|
148 | - /** |
|
149 | - * @param string $optPrefix |
|
150 | - * @return Config |
|
151 | - * @throws PhpfastcacheLogicException |
|
152 | - * @since 7.0.2 |
|
153 | - */ |
|
154 | - public function setOptPrefix(string $optPrefix): static |
|
155 | - { |
|
156 | - return $this->setProperty('optPrefix', trim($optPrefix)); |
|
157 | - } |
|
158 | - |
|
159 | - /** |
|
160 | - * @return int|null |
|
161 | - */ |
|
162 | - public function getSlaveFailover(): ?int |
|
163 | - { |
|
164 | - return $this->slaveFailover; |
|
165 | - } |
|
166 | - |
|
167 | - /** |
|
168 | - * @param int|null $slaveFailover |
|
169 | - * @return Config |
|
170 | - * @throws PhpfastcacheInvalidArgumentException |
|
171 | - */ |
|
172 | - public function setSlaveFailover(?int $slaveFailover): static |
|
173 | - { |
|
174 | - if ( |
|
175 | - $slaveFailover !== null && !in_array($slaveFailover, [ |
|
176 | - RedisClusterClient::FAILOVER_NONE, |
|
177 | - RedisClusterClient::FAILOVER_ERROR, |
|
178 | - RedisClusterClient::FAILOVER_DISTRIBUTE, |
|
179 | - RedisClusterClient::FAILOVER_DISTRIBUTE_SLAVES, |
|
180 | - ]) |
|
181 | - ) { |
|
182 | - throw new PhpfastcacheInvalidArgumentException('Invalid Slave Failover option: ' . $slaveFailover); |
|
183 | - } |
|
184 | - return $this->setProperty('slaveFailover', $slaveFailover); |
|
185 | - } |
|
26 | + /** |
|
27 | + * @var array<string> |
|
28 | + */ |
|
29 | + protected array $clusters = []; |
|
30 | + protected string $password = ''; |
|
31 | + protected int $timeout = 5; |
|
32 | + protected int $readTimeout = 5; |
|
33 | + protected ?RedisClusterClient $redisClusterClient = null; |
|
34 | + protected string $optPrefix = ''; |
|
35 | + protected ?int $slaveFailover = null; |
|
36 | + |
|
37 | + /** |
|
38 | + * @return array<string> |
|
39 | + */ |
|
40 | + public function getClusters(): array |
|
41 | + { |
|
42 | + return $this->clusters; |
|
43 | + } |
|
44 | + |
|
45 | + /** |
|
46 | + * @param string $cluster |
|
47 | + * @return Config |
|
48 | + */ |
|
49 | + public function addCluster(string $cluster): static |
|
50 | + { |
|
51 | + $this->enforceLockedProperty(__FUNCTION__); |
|
52 | + $this->clusters[] = $cluster; |
|
53 | + return $this; |
|
54 | + } |
|
55 | + |
|
56 | + /** |
|
57 | + * @param string $clusters |
|
58 | + * @return Config |
|
59 | + */ |
|
60 | + public function setClusters(...$clusters): static |
|
61 | + { |
|
62 | + return $this->setProperty('clusters', $clusters); |
|
63 | + } |
|
64 | + |
|
65 | + /** |
|
66 | + * @return string |
|
67 | + */ |
|
68 | + public function getPassword(): string |
|
69 | + { |
|
70 | + return $this->password; |
|
71 | + } |
|
72 | + |
|
73 | + /** |
|
74 | + * @param string $password |
|
75 | + * |
|
76 | + * @return static |
|
77 | + * @throws PhpfastcacheLogicException |
|
78 | + */ |
|
79 | + public function setPassword(string $password): static |
|
80 | + { |
|
81 | + return $this->setProperty('password', $password); |
|
82 | + } |
|
83 | + |
|
84 | + /** |
|
85 | + * @return int |
|
86 | + */ |
|
87 | + public function getTimeout(): int |
|
88 | + { |
|
89 | + return $this->timeout; |
|
90 | + } |
|
91 | + |
|
92 | + /** |
|
93 | + * @param int $timeout |
|
94 | + * @return static |
|
95 | + * @throws PhpfastcacheLogicException |
|
96 | + */ |
|
97 | + public function setTimeout(int $timeout): static |
|
98 | + { |
|
99 | + return $this->setProperty('timeout', $timeout); |
|
100 | + } |
|
101 | + |
|
102 | + /** |
|
103 | + * @return int |
|
104 | + */ |
|
105 | + public function getReadTimeout(): int |
|
106 | + { |
|
107 | + return $this->readTimeout; |
|
108 | + } |
|
109 | + |
|
110 | + /** |
|
111 | + * @param int $readTimeout |
|
112 | + * @return static |
|
113 | + * @throws PhpfastcacheLogicException |
|
114 | + */ |
|
115 | + public function setReadTimeout(int $readTimeout): static |
|
116 | + { |
|
117 | + return $this->setProperty('readTimeout', $readTimeout); |
|
118 | + } |
|
119 | + |
|
120 | + |
|
121 | + /** |
|
122 | + * @return RedisClusterClient|null |
|
123 | + */ |
|
124 | + public function getRedisClusterClient(): ?RedisClusterClient |
|
125 | + { |
|
126 | + return $this->redisClusterClient; |
|
127 | + } |
|
128 | + |
|
129 | + /** |
|
130 | + * @param RedisClusterClient|null $redisClusterClient |
|
131 | + * @return Config |
|
132 | + * @throws PhpfastcacheLogicException |
|
133 | + */ |
|
134 | + public function setRedisClusterClient(?RedisClusterClient $redisClusterClient): static |
|
135 | + { |
|
136 | + return $this->setProperty('redisClusterClient', $redisClusterClient); |
|
137 | + } |
|
138 | + |
|
139 | + /** |
|
140 | + * @return string |
|
141 | + * @since 7.0.2 |
|
142 | + */ |
|
143 | + public function getOptPrefix(): string |
|
144 | + { |
|
145 | + return $this->optPrefix; |
|
146 | + } |
|
147 | + |
|
148 | + /** |
|
149 | + * @param string $optPrefix |
|
150 | + * @return Config |
|
151 | + * @throws PhpfastcacheLogicException |
|
152 | + * @since 7.0.2 |
|
153 | + */ |
|
154 | + public function setOptPrefix(string $optPrefix): static |
|
155 | + { |
|
156 | + return $this->setProperty('optPrefix', trim($optPrefix)); |
|
157 | + } |
|
158 | + |
|
159 | + /** |
|
160 | + * @return int|null |
|
161 | + */ |
|
162 | + public function getSlaveFailover(): ?int |
|
163 | + { |
|
164 | + return $this->slaveFailover; |
|
165 | + } |
|
166 | + |
|
167 | + /** |
|
168 | + * @param int|null $slaveFailover |
|
169 | + * @return Config |
|
170 | + * @throws PhpfastcacheInvalidArgumentException |
|
171 | + */ |
|
172 | + public function setSlaveFailover(?int $slaveFailover): static |
|
173 | + { |
|
174 | + if ( |
|
175 | + $slaveFailover !== null && !in_array($slaveFailover, [ |
|
176 | + RedisClusterClient::FAILOVER_NONE, |
|
177 | + RedisClusterClient::FAILOVER_ERROR, |
|
178 | + RedisClusterClient::FAILOVER_DISTRIBUTE, |
|
179 | + RedisClusterClient::FAILOVER_DISTRIBUTE_SLAVES, |
|
180 | + ]) |
|
181 | + ) { |
|
182 | + throw new PhpfastcacheInvalidArgumentException('Invalid Slave Failover option: ' . $slaveFailover); |
|
183 | + } |
|
184 | + return $this->setProperty('slaveFailover', $slaveFailover); |
|
185 | + } |
|
186 | 186 | } |
@@ -24,10 +24,10 @@ |
||
24 | 24 | */ |
25 | 25 | class Item implements ExtendedCacheItemInterface |
26 | 26 | { |
27 | - use TaggableCacheItemTrait; |
|
27 | + use TaggableCacheItemTrait; |
|
28 | 28 | |
29 | - protected function getDriverClass(): string |
|
30 | - { |
|
31 | - return Driver::class; |
|
32 | - } |
|
29 | + protected function getDriverClass(): string |
|
30 | + { |
|
31 | + return Driver::class; |
|
32 | + } |
|
33 | 33 | } |
@@ -31,89 +31,89 @@ |
||
31 | 31 | */ |
32 | 32 | class Driver implements AggregatablePoolInterface |
33 | 33 | { |
34 | - use TaggableCacheItemPoolTrait; |
|
35 | - |
|
36 | - /** |
|
37 | - * @return bool |
|
38 | - */ |
|
39 | - public function driverCheck(): bool |
|
40 | - { |
|
41 | - return extension_loaded('wincache') && function_exists('wincache_ucache_set'); |
|
42 | - } |
|
43 | - |
|
44 | - public function getHelp(): string |
|
45 | - { |
|
46 | - return <<<HELP |
|
34 | + use TaggableCacheItemPoolTrait; |
|
35 | + |
|
36 | + /** |
|
37 | + * @return bool |
|
38 | + */ |
|
39 | + public function driverCheck(): bool |
|
40 | + { |
|
41 | + return extension_loaded('wincache') && function_exists('wincache_ucache_set'); |
|
42 | + } |
|
43 | + |
|
44 | + public function getHelp(): string |
|
45 | + { |
|
46 | + return <<<HELP |
|
47 | 47 | Wincache PECL extension is not maintained anymore and has been superseded. Check sourceforge for more informations: https://sourceforge.net/projects/wincache/' |
48 | 48 | HELP; |
49 | - } |
|
50 | - |
|
51 | - /** |
|
52 | - * @return DriverStatistic |
|
53 | - */ |
|
54 | - public function getStats(): DriverStatistic |
|
55 | - { |
|
56 | - $memInfo = wincache_ucache_meminfo(); |
|
57 | - $info = wincache_ucache_info(); |
|
58 | - $date = (new DateTime())->setTimestamp(time() - $info['total_cache_uptime']); |
|
59 | - |
|
60 | - return (new DriverStatistic()) |
|
61 | - ->setInfo(sprintf("The Wincache daemon is up since %s.\n For more information see RawData.", $date->format(DATE_RFC2822))) |
|
62 | - ->setSize($memInfo['memory_free'] - $memInfo['memory_total']) |
|
63 | - ->setData(implode(', ', array_keys($this->itemInstances))) |
|
64 | - ->setRawData($memInfo); |
|
65 | - } |
|
66 | - |
|
67 | - /** |
|
68 | - * @return bool |
|
69 | - */ |
|
70 | - protected function driverConnect(): bool |
|
71 | - { |
|
72 | - return true; |
|
73 | - } |
|
74 | - |
|
75 | - /** |
|
76 | - * @param ExtendedCacheItemInterface $item |
|
77 | - * @return ?array<string, mixed> |
|
78 | - */ |
|
79 | - protected function driverRead(ExtendedCacheItemInterface $item): ?array |
|
80 | - { |
|
81 | - $val = wincache_ucache_get($item->getKey(), $suc); |
|
82 | - |
|
83 | - if ($suc === false || empty($val)) { |
|
84 | - return null; |
|
85 | - } |
|
86 | - |
|
87 | - return $val; |
|
88 | - } |
|
89 | - |
|
90 | - /** |
|
91 | - * @param ExtendedCacheItemInterface $item |
|
92 | - * @return mixed |
|
93 | - * @throws PhpfastcacheInvalidArgumentException |
|
94 | - * @throws PhpfastcacheLogicException |
|
95 | - */ |
|
96 | - protected function driverWrite(ExtendedCacheItemInterface $item): bool |
|
97 | - { |
|
98 | - |
|
99 | - return wincache_ucache_set($item->getKey(), $this->driverPreWrap($item), $item->getTtl()); |
|
100 | - } |
|
101 | - |
|
102 | - /** |
|
103 | - * @param string $key |
|
104 | - * @param string $encodedKey |
|
105 | - * @return bool |
|
106 | - */ |
|
107 | - protected function driverDelete(string $key, string $encodedKey): bool |
|
108 | - { |
|
109 | - return wincache_ucache_delete($key); |
|
110 | - } |
|
111 | - |
|
112 | - /** |
|
113 | - * @return bool |
|
114 | - */ |
|
115 | - protected function driverClear(): bool |
|
116 | - { |
|
117 | - return wincache_ucache_clear(); |
|
118 | - } |
|
49 | + } |
|
50 | + |
|
51 | + /** |
|
52 | + * @return DriverStatistic |
|
53 | + */ |
|
54 | + public function getStats(): DriverStatistic |
|
55 | + { |
|
56 | + $memInfo = wincache_ucache_meminfo(); |
|
57 | + $info = wincache_ucache_info(); |
|
58 | + $date = (new DateTime())->setTimestamp(time() - $info['total_cache_uptime']); |
|
59 | + |
|
60 | + return (new DriverStatistic()) |
|
61 | + ->setInfo(sprintf("The Wincache daemon is up since %s.\n For more information see RawData.", $date->format(DATE_RFC2822))) |
|
62 | + ->setSize($memInfo['memory_free'] - $memInfo['memory_total']) |
|
63 | + ->setData(implode(', ', array_keys($this->itemInstances))) |
|
64 | + ->setRawData($memInfo); |
|
65 | + } |
|
66 | + |
|
67 | + /** |
|
68 | + * @return bool |
|
69 | + */ |
|
70 | + protected function driverConnect(): bool |
|
71 | + { |
|
72 | + return true; |
|
73 | + } |
|
74 | + |
|
75 | + /** |
|
76 | + * @param ExtendedCacheItemInterface $item |
|
77 | + * @return ?array<string, mixed> |
|
78 | + */ |
|
79 | + protected function driverRead(ExtendedCacheItemInterface $item): ?array |
|
80 | + { |
|
81 | + $val = wincache_ucache_get($item->getKey(), $suc); |
|
82 | + |
|
83 | + if ($suc === false || empty($val)) { |
|
84 | + return null; |
|
85 | + } |
|
86 | + |
|
87 | + return $val; |
|
88 | + } |
|
89 | + |
|
90 | + /** |
|
91 | + * @param ExtendedCacheItemInterface $item |
|
92 | + * @return mixed |
|
93 | + * @throws PhpfastcacheInvalidArgumentException |
|
94 | + * @throws PhpfastcacheLogicException |
|
95 | + */ |
|
96 | + protected function driverWrite(ExtendedCacheItemInterface $item): bool |
|
97 | + { |
|
98 | + |
|
99 | + return wincache_ucache_set($item->getKey(), $this->driverPreWrap($item), $item->getTtl()); |
|
100 | + } |
|
101 | + |
|
102 | + /** |
|
103 | + * @param string $key |
|
104 | + * @param string $encodedKey |
|
105 | + * @return bool |
|
106 | + */ |
|
107 | + protected function driverDelete(string $key, string $encodedKey): bool |
|
108 | + { |
|
109 | + return wincache_ucache_delete($key); |
|
110 | + } |
|
111 | + |
|
112 | + /** |
|
113 | + * @return bool |
|
114 | + */ |
|
115 | + protected function driverClear(): bool |
|
116 | + { |
|
117 | + return wincache_ucache_clear(); |
|
118 | + } |
|
119 | 119 | } |