1 | <?php |
||
11 | class MemcachedAdapter extends AbstractAdapter implements AdapterInterface |
||
12 | { |
||
13 | /** |
||
14 | * @var int |
||
15 | */ |
||
16 | protected $ttl; |
||
17 | |||
18 | /** |
||
19 | * @var Memcached |
||
20 | */ |
||
21 | protected $memcached; |
||
22 | |||
23 | public function __construct(array $config = []) |
||
24 | { |
||
25 | $this->validateMemcacheConfiguration($config); |
||
26 | |||
27 | // default config |
||
28 | $this->ttl = 0; |
||
29 | |||
30 | // config |
||
31 | if (isset($config['ttl'])) { |
||
32 | $this->ttl = $config['ttl']; |
||
33 | } |
||
34 | |||
35 | $persistentId = null; |
||
36 | if (isset($config['connection_persistent']) && $config['connection_persistent']) { |
||
37 | $persistentId = '1'; |
||
38 | |||
39 | if (isset($config['pool_size']) && $config['pool_size'] > 1) { |
||
40 | $persistentId = (string) mt_rand(1, $config['pool_size']); |
||
41 | } |
||
42 | } |
||
43 | |||
44 | $this->memcached = new Memcached($persistentId); |
||
45 | $this->memcached->addServers($config['servers']); |
||
46 | |||
47 | if (isset($config['options']) && !empty($config['options'])) { |
||
48 | $this->memcached->setOptions($config['options']); |
||
|
|||
49 | } |
||
50 | |||
51 | if (isset($config['cache_not_found_keys'])) { |
||
52 | $this->cacheNotFoundKeys = (bool) $config['cache_not_found_keys']; |
||
53 | } |
||
54 | } |
||
55 | |||
56 | public function get(string $key) |
||
66 | |||
67 | public function getMulti(array $keys): array |
||
73 | |||
74 | public function set(string $key, $value): bool |
||
78 | |||
79 | public function setMulti(array $data): bool |
||
85 | |||
86 | public function contains(string $key): bool |
||
96 | |||
97 | public function delete(string $key): bool |
||
103 | |||
104 | public function deleteMulti(array $keys): bool |
||
112 | |||
113 | public function flush(): bool |
||
117 | |||
118 | protected function validateMemcacheConfiguration(array $config) |
||
142 | } |
||
143 |
This check marks calls to methods that do not seem to exist on an object.
This is most likely the result of a method being renamed without all references to it being renamed likewise.