Esempio n. 1
0
if(!class_exists('Eden_Apc')){class Eden_Apc extends Eden_Class{public static function i(){return self::_getSingleton(__CLASS__);}public function __construct(){if(!function_exists('apc_cache_info')){Eden_Apc_Error::i(Eden_Apc_Error::NOT_INSTALLED)->trigger();}}public function clear(){apc_clear_cache();return $this;}public function get($key){Eden_Memcache_Error::i()->argument(1,'string','array');return apc_fetch($key);}public function remove($key){Eden_Memcache_Error::i()->argument(1,'string','array');apc_delete($key);return $this;}public function set($key,$data,$expire=NULL){Eden_Apc_Error::i()->argument(1,'string')->argument(3,'int','null');apc_store($key,$data,$expire);return $this;}}class Eden_Apc_Error extends Eden_Error{const NOT_INSTALLED='APC is not installed.';public static function i($message=NULL,$code=0){$class=__CLASS__;return new $class($message,$code);}}}
Esempio n. 2
0
 /**
  * Sets a data cache
  *
  * @param string the key to the data
  * @param variable the data to be cached
  * @param int expire 
  * @return bool
  */
 public function set($key, $data, $expire = NULL)
 {
     //argument test
     Eden_Apc_Error::i()->argument(1, 'string')->argument(3, 'int', 'null');
     //Argument 2 must be an integer or null
     apc_store($key, $data, $expire);
     return $this;
 }
Esempio n. 3
0
 public function set($key, $data, $expire = NULL)
 {
     Eden_Apc_Error::i()->argument(1, 'string')->argument(3, 'int', 'null');
     apc_store($key, $data, $expire);
     return $this;
 }