コード例 #1
0
 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();
 }
コード例 #2
0
 /**
  * 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);
         }
     }
 }
コード例 #3
0
 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;
 }