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|bool |
||
36 | * |
||
37 | * Fetch object from cache |
||
38 | */ |
||
39 | public static function fetch($key, $className) |
||
50 | |||
51 | /** |
||
52 | * @param $key |
||
53 | * @return bool |
||
54 | * |
||
55 | * Remove object from cache |
||
56 | */ |
||
57 | public static function remove($key) |
||
66 | |||
67 | /** |
||
68 | * @param $key |
||
69 | * @return bool |
||
70 | * |
||
71 | * Check object is cached or not |
||
72 | */ |
||
73 | public static function exists($key) |
||
77 | |||
78 | /** |
||
79 | * @param $key |
||
80 | * @return bool|string |
||
81 | */ |
||
82 | protected static function getTempFile($key) |
||
90 | |||
91 | /** |
||
92 | * @param $key |
||
93 | * @return bool|string |
||
94 | */ |
||
95 | protected static function createTempFile($key, $ttl) |
||
102 | |||
103 | /** |
||
104 | * @param object $object |
||
105 | * @return string |
||
106 | */ |
||
107 | protected static function encode($object) |
||
111 | |||
112 | /** |
||
113 | * @param string $string |
||
114 | * @return object |
||
115 | */ |
||
116 | protected static function decode($string) |
||
120 | } |