1 | <?php |
||
12 | class AdapterApc implements iAdapter |
||
13 | { |
||
14 | |||
15 | /** |
||
16 | * @var bool |
||
17 | */ |
||
18 | public $installed = false; |
||
19 | |||
20 | /** |
||
21 | * @var bool |
||
22 | */ |
||
23 | public $debug = false; |
||
24 | |||
25 | /** |
||
26 | * __construct() |
||
27 | */ |
||
28 | 15 | public function __construct() |
|
34 | |||
35 | /** |
||
36 | * cacheInfo |
||
37 | * |
||
38 | * Retrieves cached information from APC's data store |
||
39 | * |
||
40 | * @param string $type - If $type is "user", information about the user cache will be returned. |
||
41 | * @param boolean $limited - If $limited is TRUE, the return value will exclude the individual list of cache entries. |
||
42 | * This is useful when trying to optimize calls for statistics gathering. |
||
43 | * |
||
44 | * @return array of cached data (and meta-data) or FALSE on failure. |
||
45 | */ |
||
46 | public function cacheInfo($type = '', $limited = false) |
||
50 | |||
51 | /* |
||
52 | * apc_cache_exists (fallback function for old apc) |
||
53 | * |
||
54 | * * @return boolean |
||
55 | */ |
||
56 | |||
57 | /** |
||
58 | * Cache a variable in the data-store |
||
59 | * |
||
60 | * @param string $key |
||
61 | * @param mixed $value |
||
62 | * |
||
63 | * @return Boolean - Returns TRUE on success or FALSE on failure. |
||
64 | */ |
||
65 | 2 | public function set($key, $value) |
|
69 | |||
70 | /** |
||
71 | * Cache a variable in the data-store with ttl |
||
72 | * |
||
73 | * @param string $key - Store the variable using this name. |
||
74 | * @param string $data - The variable to store. |
||
75 | * @param string $ttl - Time To Live; store var in the cache for ttl seconds. "0" for no ttl |
||
76 | * |
||
77 | * @return boolean - Returns TRUE on success or FALSE on failure. |
||
78 | */ |
||
79 | 1 | public function setExpired($key, $data, $ttl) |
|
83 | |||
84 | /** |
||
85 | * |
||
86 | * get stored value in APC from key |
||
87 | * |
||
88 | * @param string $key - The key used to store the value. |
||
89 | * |
||
90 | * @return boolean - The stored variable or array of variables on success; FALSE on failure. |
||
91 | */ |
||
92 | 3 | public function get($key) |
|
100 | |||
101 | /** |
||
102 | * Checks if APC key exists |
||
103 | * |
||
104 | * @param mixed $key - A string, or an array of strings, that contain keys. |
||
105 | * |
||
106 | * @return mixed - Returns TRUE if the key exists, otherwise FALSE Or if an array was passed to keys, then an array |
||
107 | * is returned that contains all existing keys, or an empty array if none exist. |
||
108 | */ |
||
109 | 4 | public function exists($key) |
|
117 | |||
118 | /** |
||
119 | * check if apc-cache exists |
||
120 | * |
||
121 | * @param string $key |
||
122 | * |
||
123 | * @return bool |
||
124 | */ |
||
125 | public function apc_cache_exists($key) |
||
129 | |||
130 | /** |
||
131 | * Removes a stored variable from the cache |
||
132 | * |
||
133 | * @param string $key - The key used to store the value (with apc_store()). |
||
134 | * |
||
135 | * @return boolean - Returns TRUE on success or FALSE on failure. |
||
136 | */ |
||
137 | public function remove($key) |
||
141 | |||
142 | /** |
||
143 | * Clears the APC cache |
||
144 | * |
||
145 | * @param string $type - If $type is "user", the user cache will be cleared; otherwise, the system cache (cached |
||
146 | * files) will be cleared. |
||
147 | * |
||
148 | * @return boolean - Returns TRUE on success or FALSE on failure. |
||
149 | */ |
||
150 | public function cacheClear($type) |
||
154 | |||
155 | /** |
||
156 | * check if cache is installed |
||
157 | * |
||
158 | * @return boolean |
||
159 | */ |
||
160 | 6 | public function installed() |
|
164 | |||
165 | } |
||
166 |