1 | <?php |
||
29 | abstract class Base extends \csphere\core\service\Drivers |
||
30 | { |
||
31 | /** |
||
32 | * Stores the logger object |
||
33 | **/ |
||
34 | protected $logger = null; |
||
35 | |||
36 | /** |
||
37 | * Clears the cache content |
||
38 | * |
||
39 | * @return boolean |
||
40 | **/ |
||
|
|||
41 | |||
42 | abstract public function clear(); |
||
43 | |||
44 | /** |
||
45 | * Removes a cached key |
||
46 | * |
||
47 | * @param string $key Name of the key |
||
48 | * @param int $ttl Time to life used for the key |
||
49 | * |
||
50 | * @return boolean |
||
51 | **/ |
||
52 | |||
53 | abstract public function delete($key, $ttl = 0); |
||
54 | |||
55 | /** |
||
56 | * Returns a formatted array with statistics |
||
57 | * |
||
58 | * @return array |
||
59 | **/ |
||
60 | |||
61 | public function info() |
||
69 | |||
70 | /** |
||
71 | * Returns a formatted array with all keys and additional information |
||
72 | * |
||
73 | * @return array |
||
74 | **/ |
||
75 | |||
76 | abstract public function keys(); |
||
77 | |||
78 | /** |
||
79 | * Fetches the desired key |
||
80 | * |
||
81 | * @param string $key Name of the key |
||
82 | * @param int $ttl Time to life used for the key |
||
83 | * |
||
84 | * @return array |
||
85 | **/ |
||
86 | |||
87 | abstract public function load($key, $ttl = 0); |
||
88 | |||
89 | /** |
||
90 | * Fetches the desired keys |
||
91 | * |
||
92 | * @param array $keys Name of the keys |
||
93 | * |
||
94 | * @return array |
||
95 | **/ |
||
96 | |||
97 | public function loadArray(array $keys) |
||
109 | |||
110 | /** |
||
111 | * Logs cache inserts |
||
112 | * |
||
113 | * @param string $key The cache key that is stored |
||
114 | * |
||
115 | * @return void |
||
116 | **/ |
||
117 | |||
118 | protected function log($key) |
||
128 | |||
129 | /** |
||
130 | * Stores the key with its value in the cache |
||
131 | * |
||
132 | * @param string $key Name of the key |
||
133 | * @param array $value Content to be stored |
||
134 | * @param int $ttl Time to life used for the key |
||
135 | * |
||
136 | * @return boolean |
||
137 | **/ |
||
138 | |||
139 | abstract public function save($key, $value, $ttl = 0); |
||
140 | } |
||
141 |