1 | <?php |
||
11 | class Cache { |
||
12 | |||
13 | /** |
||
14 | * Connection to a set of memcache servers |
||
15 | * |
||
16 | * @var Memcache |
||
17 | */ |
||
18 | public static $server = null; |
||
19 | |||
20 | /** |
||
21 | * Truing to connect flag |
||
22 | * |
||
23 | * @var boolean |
||
24 | */ |
||
25 | public static $connectTrying = false; |
||
26 | |||
27 | /** |
||
28 | * Connected flag |
||
29 | * |
||
30 | * @var boolean |
||
31 | */ |
||
32 | public static $connected = false; |
||
33 | |||
34 | /** |
||
35 | * Try connect to memcache server |
||
36 | */ |
||
37 | public static function connect() { |
||
44 | |||
45 | /** |
||
46 | * Get chached value |
||
47 | * |
||
48 | * If value not present, call callback |
||
49 | * |
||
50 | * @param string $name |
||
51 | * @param array $params |
||
52 | * @param callable $callback |
||
53 | * @return boolean |
||
54 | */ |
||
55 | public static function get($name, $params = [], $callback = null, $lifeTime = 3600) { |
||
85 | |||
86 | /** |
||
87 | * Set value to cache |
||
88 | * |
||
89 | * @param string $name |
||
90 | * @param array $params |
||
91 | * @param mixed $val |
||
92 | * @param int $lifeTime |
||
93 | * @return boolean |
||
94 | */ |
||
95 | public static function set($name, $params = [], $val = '', $lifeTime = 3600) { |
||
104 | |||
105 | /** |
||
106 | * Move file to cache folder and return path |
||
107 | * |
||
108 | * Also resize image when given resize params |
||
109 | * |
||
110 | * @param string $file |
||
111 | * @param array $options |
||
112 | * @return string |
||
113 | */ |
||
114 | public static function file($file, $options = []) { |
||
134 | |||
135 | /** |
||
136 | * Get cache dir for app |
||
137 | * |
||
138 | * @param App $app |
||
139 | * @return string |
||
140 | */ |
||
141 | public static function getDir($dirname, $app = null) { |
||
149 | |||
150 | public static function folder() { |
||
153 | } |