-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCache.php
44 lines (43 loc) · 1.33 KB
/
Cache.php
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
42
43
44
<?php
/**
* $providerList = Evil_Cache::load('uniqueid');
* Evil_Cache::save(array("data"=>time(),'uniqueid');
* Простенькая обвязка над Zend_cache
* @author nur
*
*/
class Evil_Cache
{
protected $cache = null;
private static $instance;
public static $lifetime = 7200; //2
private static function getInstance(){
if(!isset(self::$instance)){
self::$instance = new self();
}
return self::$instance;
}
public function __construct ()
{
if (null == $this->cache) {
$frontendOptions = array('lifetime' => self::$lifetime,
'automatic_serialization' => true);
$backendOptions = array('cache_dir' => APPLICATION_PATH . '/cache');
$this->cache = Zend_Cache::factory('Core', 'File',
$frontendOptions, $backendOptions);
}
}
public function __call($methodName,$params)
{
return call_user_func_array(array($this->cache,$methodName), $params);
}
/**
*
* Вот тут я сомневаюсь что не наклал =(
* @param unknown_type $methodName
* @param unknown_type $params
*/
public static function __callStatic($methodName,$params) {
return call_user_func_array(array(self::getInstance()->cache,$methodName), $params);
}
}