memcached website: http://www.danga.com/memcached/
Author: Jan Schneider (jan@horde.org)
Author: Michael Slusarz (slusarz@horde.org)
Author: Didi Rieder (adrieder@sbox.tugraz.at)
Inheritance: implements Serializable
Esempio n. 1
0
 public static function setUpBeforeClass()
 {
     if (!extension_loaded('memcache')) {
         self::$reason = 'No memcache extension.';
         return;
     }
     $config = self::getConfig('SESSIONHANDLER_MEMCACHE_TEST_CONFIG', dirname(__FILE__) . '/..');
     if (!$config || empty($config['sessionhandler']['memcache'])) {
         self::$reason = 'No memcache configuration.';
         return;
     }
     $memcache = new Horde_Memcache($config['sessionhandler']['memcache']);
     $memcache->delete('sessionid');
     $memcache->delete('sessionid2');
     self::$handler = new Horde_SessionHandler_Storage_Memcache(array('memcache' => $memcache, 'track' => true));
     parent::setUpBeforeClass();
 }
Esempio n. 2
0
 /**
  * Do garbage collection for session tracking information.
  */
 public function trackGC()
 {
     $this->_memcache->lock($this->_trackID);
     $ids = $this->_memcache->get($this->_trackID);
     if (empty($ids)) {
         $this->_memcache->unlock($this->_trackID);
         return;
     }
     $tstamp = time() - $this->_params['track_lifetime'];
     $alter = false;
     foreach ($ids as $key => $val) {
         if ($tstamp > $val) {
             unset($ids[$key]);
             $alter = true;
         }
     }
     if ($alter) {
         $this->_memcache->set($this->_trackID, $ids);
     }
     $this->_memcache->unlock($this->_trackID);
 }
Esempio n. 3
0
 /**
  */
 public function clear()
 {
     $this->_memcache->flush();
 }
Esempio n. 4
0
 /**
  * Get the statistics output from the current memcache pool.
  *
  * @see Horde_Memcache#stats()
  */
 public function stats()
 {
     return $this->_memcache->stats();
 }
Esempio n. 5
0
 /**
  */
 public function clear()
 {
     $this->_memcache->flush();
     $this->_objectcache = array();
 }