Ejemplo n.º 1
0
 public function deleteCache($key)
 {
     if ($this->hasCache === false) {
         return true;
     }
     return $this->cache->delete(MEMCACHE_KEY . $key);
 }
Ejemplo n.º 2
0
 /**
  * @return Memcache|the
  */
 public function getMemCache()
 {
     if ($this->_cache === null) {
         if (class_exists('Alibaba', false)) {
             $this->_cache = Alibaba::Cache('memcache');
         } else {
             $memcache = new CMemCache();
             $memcache->setServers($this->_servers);
             $memcache->init();
             $this->_cache = $memcache;
         }
     }
     return $this->_cache;
 }
Ejemplo n.º 3
0
 public function init()
 {
     parent::init();
     $cache = $this->getMemCache();
     if ($cache) {
         $this->enable = true;
         $this->type = "memcache";
     }
 }
Ejemplo n.º 4
0
 /**
  * Constructor	 
  */
 public function __construct()
 {
     parent::__construct('mymc');
     if (!isset(self::$_cache)) {
         // load config file
         global $memcache_i;
         self::$_cache = new Memcache();
         self::$_cache->connect($memcache_i['server'], $memcache_i['port']);
     }
 }
Ejemplo n.º 5
0
 public function delete($id)
 {
     $this->getSlave() && $this->getSlave()->delete($id);
     return parent::delete($id);
 }