public function __construct(&$config, &$db_assertor) { parent::__construct($config, $db_assertor); if (!empty($config['Cache']['memcacheprefix'])) { $this->prefix =& $config['Cache']['memcacheprefix']; } $this->memcache = vB_Memcache::instance(); }
/** * Cleans cache. * * @param bool $only_expired - Only clean expired entries */ public function clean($only_expired = true) { if (!$only_expired) { $this->memcached->flush(); $this->cleanNow(); $this->events = array(); if (self::$cacheLogging) { $this->logCacheAction(0, self::CACHE_LOG_CLEAR, $this->cachetype); } } }
public static function instance() { if (!isset(self::$instance)) { if (class_exists('Memcached', FALSE)) { $class = 'vB_Memcached'; } else { if (class_exists('Memcache', FALSE)) { $class = __CLASS__; } else { throw new Exception('Memcached is not installed'); } } self::$instance = new $class(); self::$instance->config = vB::getConfig(); } return self::$instance; }