- Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathCache.php
More file actions
Latest commit
41 lines (33 loc) · 910 Bytes
/
Copy pathCache.php
File metadata and controls
41 lines (33 loc) · 910 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<?php
class Wave_Cache {
privatestatic$_ready = false;
privatestatic$_cachepath = null;
publicstaticfunctioninit(){
self::$_cachepath = Wave_Config::get('wave')->path->cache;
self::$_ready = true;
}
publicstaticfunctionload($key){
$filename = self::$_cachepath . $key;
if(file_exists($filename))
returnunserialize(file_get_contents(self::$_cachepath . $key));
else
returnnull;
}
publicstaticfunctionstore($key, $data){
$path = self::$_cachepath . $key;
$dir = dirname(self::$_cachepath . $key);
if(!is_dir($dir))
@mkdir($dir, 0770, true);
file_put_contents($path, serialize($data));
}
publicstaticfunctiondelete($key){
@unlink(self::$_cachepath . $key);
}
publicstaticfunctioncachetime($key){
$filename = self::$_cachepath . $key;
if(file_exists($filename))
returnfilemtime(self::$_cachepath . $key);
else
return0;
}
}