/** */ public function write($id, $session_data) { if (!empty($this->_params['track'])) { // Do a replace - the only time it should fail is if we are // writing a session for the first time. If that is the case, // update the session tracker. $res = $this->_memcache->replace($id, $session_data); $track = !$res; } else { $res = $track = false; } if (!$res && !$this->_memcache->set($id, $session_data)) { return false; } if ($track) { $this->_memcache->lock($this->_trackID); $ids = $this->_memcache->get($this->_trackID); if ($ids === false) { $ids = array(); } $ids[$id] = time(); $this->_memcache->set($this->_trackID, $ids); $this->_memcache->unlock($this->_trackID); } return true; }
/** */ 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); }