3
* @link https://www.yiiframework.com/
4
* @copyright Copyright (c) 2008 Yii Software LLC
5
* @license https://www.yiiframework.com/license/
11
* DummyCache is a placeholder cache component.
13
* DummyCache does not cache anything. It is provided so that one can always configure
14
* a 'cache' application component and save the check of existence of `\Yii::$app->cache`.
15
* By replacing DummyCache with some other cache component, one can quickly switch from
16
* non-caching mode to caching mode.
18
* For more details and usage information on Cache, see the [guide article on caching](guide:caching-overview).
20
* @author Qiang Xue <qiang.xue@gmail.com>
23
class DummyCache extends Cache
26
* Retrieves a value from cache with a specified key.
27
* This is the implementation of the method declared in the parent class.
28
* @param string $key a unique key identifying the cached value
29
* @return mixed|false the value stored in cache, false if the value is not in the cache or expired.
31
protected function getValue($key)
37
* Stores a value identified by a key in cache.
38
* This is the implementation of the method declared in the parent class.
40
* @param string $key the key identifying the value to be cached
41
* @param mixed $value the value to be cached
42
* @param int $duration the number of seconds in which the cached value will expire. 0 means never expire.
43
* @return bool true if the value is successfully stored into cache, false otherwise
45
protected function setValue($key, $value, $duration)
51
* Stores a value identified by a key into cache if the cache does not contain this key.
52
* This is the implementation of the method declared in the parent class.
53
* @param string $key the key identifying the value to be cached
54
* @param mixed $value the value to be cached
55
* @param int $duration the number of seconds in which the cached value will expire. 0 means never expire.
56
* @return bool true if the value is successfully stored into cache, false otherwise
58
protected function addValue($key, $value, $duration)
64
* Deletes a value with the specified key from cache
65
* This is the implementation of the method declared in the parent class.
66
* @param string $key the key of the value to be deleted
67
* @return bool if no error happens during deletion
69
protected function deleteValue($key)
75
* Deletes all values from cache.
76
* This is the implementation of the method declared in the parent class.
77
* @return bool whether the flush operation was successful.
79
protected function flushValues()