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 | * @return object|mixed|bool |
||
36 | * |
||
37 | * Fetch data from cache |
||
38 | */ |
||
39 | public static function fetch($key, $className = '', $isArray = false) |
||
55 | |||
56 | /** |
||
57 | * @param $key |
||
58 | * @return array |
||
59 | * |
||
60 | * Fetch array from cache |
||
61 | */ |
||
62 | public static function fetchArray($key) |
||
66 | |||
67 | /** |
||
68 | * @param $key |
||
69 | * @return bool |
||
70 | * |
||
71 | * Remove object from cache |
||
72 | */ |
||
73 | public static function remove($key) |
||
82 | |||
83 | /** |
||
84 | * @param $key |
||
85 | * @return bool |
||
86 | * |
||
87 | * Check object is cached or not |
||
88 | */ |
||
89 | public static function exists($key) |
||
93 | |||
94 | /** |
||
95 | * @param $key |
||
96 | * @return bool|string |
||
97 | */ |
||
98 | protected static function getTempFile($key) |
||
106 | |||
107 | /** |
||
108 | * @param $key |
||
109 | * @return bool|string |
||
110 | */ |
||
111 | protected static function createTempFile($key, $ttl) |
||
118 | |||
119 | /** |
||
120 | * @param object $object |
||
121 | * @return string |
||
122 | */ |
||
123 | protected static function encode($object) |
||
127 | |||
128 | /** |
||
129 | * @param string $string |
||
130 | * @return object |
||
131 | */ |
||
132 | protected static function decode($string) |
||
136 | } |