1 | <?php |
||
62 | class MemCached extends Cache |
||
63 | { |
||
64 | /** |
||
65 | * @var string an ID that identifies a Memcached instance. |
||
66 | * By default the Memcached instances are destroyed at the end of the request. To create an instance that |
||
67 | * persists between requests, you may specify a unique ID for the instance. All instances created with the |
||
68 | * same ID will share the same connection. |
||
69 | * @see http://ca2.php.net/manual/en/memcached.construct.php |
||
70 | */ |
||
71 | public $persistentId; |
||
72 | /** |
||
73 | * @var array options for Memcached. |
||
74 | * @see http://ca2.php.net/manual/en/memcached.setoptions.php |
||
75 | */ |
||
76 | public $options; |
||
77 | /** |
||
78 | * @var string memcached sasl username. |
||
79 | * @see http://php.net/manual/en/memcached.setsaslauthdata.php |
||
80 | */ |
||
81 | public $username; |
||
82 | /** |
||
83 | * @var string memcached sasl password. |
||
84 | * @see http://php.net/manual/en/memcached.setsaslauthdata.php |
||
85 | */ |
||
86 | public $password; |
||
87 | |||
88 | /** |
||
89 | * @var \Memcached the Memcached instance |
||
90 | */ |
||
91 | private $_cache; |
||
92 | /** |
||
93 | * @var array list of memcached server configurations |
||
94 | */ |
||
95 | private $_servers = []; |
||
96 | |||
97 | |||
98 | /** |
||
99 | * Initializes this application component. |
||
100 | * It creates the memcached instance and adds memcached servers. |
||
101 | */ |
||
102 | public function init() |
||
107 | |||
108 | /** |
||
109 | * Add servers to the server pool of the cache specified |
||
110 | * |
||
111 | * @param \Memcached $cache |
||
112 | * @param MemCachedServer[] $servers |
||
113 | * @throws InvalidConfigException |
||
114 | */ |
||
115 | protected function addServers($cache, $servers) |
||
142 | |||
143 | /** |
||
144 | * Returns the underlying memcached object. |
||
145 | * @return \Memcached the memcached object used by this cache component. |
||
146 | * @throws InvalidConfigException if memcached extension is not loaded |
||
147 | */ |
||
148 | public function getMemcached() |
||
167 | |||
168 | /** |
||
169 | * Returns the memcached server configurations. |
||
170 | * @return MemCachedServer[] list of memcached server configurations. |
||
171 | */ |
||
172 | public function getServers() |
||
176 | |||
177 | /** |
||
178 | * @param array $config list of memcached server configurations. Each element must be an array |
||
179 | * with the following keys: host, port, persistent, weight, timeout, retryInterval, status. |
||
180 | * @see http://php.net/manual/en/memcached.addserver.php |
||
181 | */ |
||
182 | public function setServers($config) |
||
188 | |||
189 | /** |
||
190 | * Retrieves a value from cache with a specified key. |
||
191 | * This is the implementation of the method declared in the parent class. |
||
192 | * @param string $key a unique key identifying the cached value |
||
193 | * @return mixed|false the value stored in cache, false if the value is not in the cache or expired. |
||
194 | */ |
||
195 | protected function getValue($key) |
||
199 | |||
200 | /** |
||
201 | * Retrieves multiple values from cache with the specified keys. |
||
202 | * @param array $keys a list of keys identifying the cached values |
||
203 | * @return array a list of cached values indexed by the keys |
||
204 | */ |
||
205 | protected function getValues($keys) |
||
209 | |||
210 | /** |
||
211 | * Stores a value identified by a key in cache. |
||
212 | * This is the implementation of the method declared in the parent class. |
||
213 | * |
||
214 | * @param string $key the key identifying the value to be cached |
||
215 | * @param mixed $value the value to be cached. |
||
216 | * @see [Memcached::set()](http://php.net/manual/en/memcached.set.php) |
||
217 | * @param int $duration the number of seconds in which the cached value will expire. 0 means never expire. |
||
218 | * @return bool true if the value is successfully stored into cache, false otherwise |
||
219 | */ |
||
220 | protected function setValue($key, $value, $duration) |
||
228 | |||
229 | /** |
||
230 | * Stores multiple key-value pairs in cache. |
||
231 | * @param array $data array where key corresponds to cache key while value is the value stored |
||
232 | * @param int $duration the number of seconds in which the cached values will expire. 0 means never expire. |
||
233 | * @return array array of failed keys. |
||
234 | */ |
||
235 | protected function setValues($data, $duration) |
||
245 | |||
246 | /** |
||
247 | * Stores a value identified by a key into cache if the cache does not contain this key. |
||
248 | * This is the implementation of the method declared in the parent class. |
||
249 | * |
||
250 | * @param string $key the key identifying the value to be cached |
||
251 | * @param mixed $value the value to be cached |
||
252 | * @see [Memcached::set()](http://php.net/manual/en/memcached.set.php) |
||
253 | * @param int $duration the number of seconds in which the cached value will expire. 0 means never expire. |
||
254 | * @return bool true if the value is successfully stored into cache, false otherwise |
||
255 | */ |
||
256 | protected function addValue($key, $value, $duration) |
||
264 | |||
265 | /** |
||
266 | * Deletes a value with the specified key from cache |
||
267 | * This is the implementation of the method declared in the parent class. |
||
268 | * @param string $key the key of the value to be deleted |
||
269 | * @return bool if no error happens during deletion |
||
270 | */ |
||
271 | protected function deleteValue($key) |
||
275 | |||
276 | /** |
||
277 | * Deletes all values from cache. |
||
278 | * This is the implementation of the method declared in the parent class. |
||
279 | * @return bool whether the flush operation was successful. |
||
280 | */ |
||
281 | protected function flushValues() |
||
285 | } |
||
286 |
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.