1 | <?php |
||
17 | class BaseCache |
||
18 | { |
||
19 | /** |
||
20 | * @param $key |
||
21 | * @param $data |
||
22 | * @return bool |
||
23 | * |
||
24 | * Add object to cache list and save object as json file |
||
25 | */ |
||
26 | public static function add($key, $data, $ttl = 0) |
||
31 | |||
32 | /** |
||
33 | * @param $key |
||
34 | * @param string $className |
||
35 | * @param bool $isArray |
||
36 | * @return object|mixed|bool |
||
37 | * |
||
38 | * Fetch data from cache |
||
39 | */ |
||
40 | public static function fetch($key, $className = '', $isArray = false) |
||
56 | |||
57 | /** |
||
58 | * @param $key |
||
59 | * @return array |
||
60 | * |
||
61 | * Fetch array from cache |
||
62 | */ |
||
63 | public static function fetchArray($key) |
||
67 | |||
68 | /** |
||
69 | * @param $key |
||
70 | * @return bool |
||
71 | * |
||
72 | * Remove object from cache |
||
73 | */ |
||
74 | public static function remove($key) |
||
83 | |||
84 | /** |
||
85 | * @param $key |
||
86 | * @return bool |
||
87 | * |
||
88 | * Check object is cached or not |
||
89 | */ |
||
90 | public static function exists($key) |
||
94 | |||
95 | /** |
||
96 | * @param $key |
||
97 | * @return bool|string |
||
98 | */ |
||
99 | protected static function getTempFile($key) |
||
107 | |||
108 | /** |
||
109 | * @param $key |
||
110 | * @return bool|string |
||
111 | */ |
||
112 | protected static function createTempFile($key, $ttl) |
||
119 | |||
120 | /** |
||
121 | * @param object $object |
||
122 | * @return string |
||
123 | */ |
||
124 | protected static function encode($object) |
||
128 | |||
129 | /** |
||
130 | * @param string $string |
||
131 | * @return object |
||
132 | */ |
||
133 | protected static function decode($string) |
||
137 | } |