示例#1
0
文件: db.php 项目: kmewhort/nomus
 function flush($time = NULL)
 {
     if (empty($time)) {
         $time = time();
     }
     parent::flush($time);
     db_query("DELETE FROM {" . $this->name . "} WHERE expire != %d AND expire < %d", CACHE_PERMANENT, $time);
 }
示例#2
0
文件: file.php 项目: kmewhort/nomus
 function __construct($bin, $options, $default_options)
 {
     // Assign the path on the following order: bin specific -> default specific -> /tmp/filepath
     if (isset($options['path'])) {
         $this->fspath = $options['path'];
     } elseif (isset($default_options['path'])) {
         $this->fspath = $default_options['path'];
     }
     if (substr($this->fspath, -1) == '/') {
         $this->fspath = substr($this->fspath, 0, strlen($this->fspath) - 2);
     }
     parent::__construct($bin, $options, $default_options);
 }
示例#3
0
文件: apc.php 项目: chgk/db.chgk.info
 /**
  * flush()
  *   Flush the entire cache.
  *
  * @param none
  * @return mixed bool
  *   Returns TRUE
  */
 function flush()
 {
     parent::flush();
     if ($this->lock()) {
         // Get lookup table to be able to keep track of bins
         $lookup = $this->getLookup();
         // If the lookup table is empty, remove lock and return
         if (!is_array($lookup) || empty($lookup)) {
             $this->unlock();
             return TRUE;
         }
         // Cycle through keys and remove each entry from the cache
         foreach ($lookup as $k => $expire) {
             if ($expire != CACHE_PERMANENT && $expire <= time()) {
                 apc_delete($k);
                 unset($lookup[$k]);
             }
         }
         // Resave the lookup table (even on failure)
         $this->setLookup($lookup);
         // Remove lock
         $this->unlock();
     }
     return TRUE;
 }
示例#4
0
 function flush()
 {
     // Flush static cache
     parent::flush();
     // If this is a shared cache, we need to cycle through the lookup table and remove individual
     // items directly
     if ($this->settings['shared']) {
         if ($this->lock()) {
             // Get lookup table to be able to keep track of bins
             $lookup = $this->memcache->get($this->lookup);
             // If the lookup table is empty, remove lock and return
             if (!is_array($lookup) || empty($lookup)) {
                 $this->unlock();
                 return TRUE;
             }
             // Cycle through keys and remove each entry from the cache
             foreach ($lookup as $k => $expire) {
                 if ($expire != CACHE_PERMANENT && $expire < time()) {
                     $this->memcache->delete($k);
                     unset($lookup[$k]);
                 }
             }
             // Resave the lookup table (even on failure)
             $this->memcache->set($this->lookup, $lookup, FALSE, 0);
             // Remove lock
             $this->unlock();
         }
     } else {
         // Flush memcache
         return $this->memcache->flush();
     }
 }