1 | <?php |
||
21 | class WinCache extends Cache |
||
22 | { |
||
23 | /** |
||
24 | * Checks whether a specified key exists in the cache. |
||
25 | * This can be faster than getting the value from the cache if the data is big. |
||
26 | * Note that this method does not check whether the dependency associated |
||
27 | * with the cached data, if there is any, has changed. So a call to [[get]] |
||
28 | * may return false while exists returns true. |
||
29 | * @param mixed $key a key identifying the cached value. This can be a simple string or |
||
30 | * a complex data structure consisting of factors representing the key. |
||
31 | * @return boolean true if a value exists in cache, false if the value is not in the cache or expired. |
||
32 | */ |
||
33 | public function exists($key) |
||
39 | |||
40 | /** |
||
41 | * Retrieves a value from cache with a specified key. |
||
42 | * This is the implementation of the method declared in the parent class. |
||
43 | * @param string $key a unique key identifying the cached value |
||
44 | * @return string|boolean the value stored in cache, false if the value is not in the cache or expired. |
||
45 | */ |
||
46 | protected function getValue($key) |
||
50 | |||
51 | /** |
||
52 | * Retrieves multiple values from cache with the specified keys. |
||
53 | * @param array $keys a list of keys identifying the cached values |
||
54 | * @return array a list of cached values indexed by the keys |
||
55 | */ |
||
56 | protected function getValues($keys) |
||
60 | |||
61 | /** |
||
62 | * Stores a value identified by a key in cache. |
||
63 | * This is the implementation of the method declared in the parent class. |
||
64 | * |
||
65 | * @param string $key the key identifying the value to be cached |
||
66 | * @param string $value the value to be cached |
||
67 | * @param integer $duration the number of seconds in which the cached value will expire. 0 means never expire. |
||
68 | * @return boolean true if the value is successfully stored into cache, false otherwise |
||
69 | */ |
||
70 | protected function setValue($key, $value, $duration) |
||
74 | |||
75 | /** |
||
76 | * Stores multiple key-value pairs in cache. |
||
77 | * @param array $data array where key corresponds to cache key while value is the value stored |
||
78 | * @param integer $duration the number of seconds in which the cached values will expire. 0 means never expire. |
||
79 | * @return array array of failed keys |
||
80 | */ |
||
81 | protected function setValues($data, $duration) |
||
85 | |||
86 | /** |
||
87 | * Stores a value identified by a key into cache if the cache does not contain this key. |
||
88 | * This is the implementation of the method declared in the parent class. |
||
89 | * |
||
90 | * @param string $key the key identifying the value to be cached |
||
91 | * @param string $value the value to be cached |
||
92 | * @param integer $duration the number of seconds in which the cached value will expire. 0 means never expire. |
||
93 | * @return boolean true if the value is successfully stored into cache, false otherwise |
||
94 | */ |
||
95 | protected function addValue($key, $value, $duration) |
||
99 | |||
100 | /** |
||
101 | * Adds multiple key-value pairs to cache. |
||
102 | * The default implementation calls [[addValue()]] multiple times add values one by one. If the underlying cache |
||
103 | * storage supports multiadd, this method should be overridden to exploit that feature. |
||
104 | * @param array $data array where key corresponds to cache key while value is the value stored |
||
105 | * @param integer $duration the number of seconds in which the cached values will expire. 0 means never expire. |
||
106 | * @return array array of failed keys |
||
107 | */ |
||
108 | protected function addValues($data, $duration) |
||
112 | |||
113 | /** |
||
114 | * Deletes a value with the specified key from cache |
||
115 | * This is the implementation of the method declared in the parent class. |
||
116 | * @param string $key the key of the value to be deleted |
||
117 | * @return boolean if no error happens during deletion |
||
118 | */ |
||
119 | protected function deleteValue($key) |
||
123 | |||
124 | /** |
||
125 | * Deletes all values from cache. |
||
126 | * This is the implementation of the method declared in the parent class. |
||
127 | * @return boolean whether the flush operation was successful. |
||
128 | */ |
||
129 | protected function flushValues() |
||
133 | } |
||
134 |