/** */ public function set($key, $data, $lifetime = 0) { $key = $this->_params['prefix'] . $key; if ($this->_memcache->set($key . '_e', time(), $lifetime) !== false) { $this->_memcache->set($key, $data, $lifetime); } }
/** * 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); }
/** */ protected function _set($key, $val, $opts) { return empty($opts['replace']) ? $this->_memcache->set($key, $val, isset($opts['expire']) ? $opts['expire'] : 0) : $this->_memcache->replace($key, $val, isset($opts['expire']) ? $opts['expire'] : 0); }