/** * Stores a value identified by a key in cache. * This is the implementation of the method declared in the parent class. * @param string $key the key identifying the value to be cached * @param string $value the value to be cached * @param integer $expire the number of seconds in which the cached value will expire. 0 means never expire. * @return boolean true if the value is successfully stored into cache, false otherwise */ public function setValue($key, $value, $expire) { $this->ssdb->hset($this->cache_keys_hash, $key, 1); $data = $this->is_unserialize ? serialize($value) : $value; if ($expire > 0) { //$expire += time(); return $this->ssdb->setx($key, $data, (int) $expire); } else { return $this->ssdb->set($key, $data); } }
/** * Session write handler. * Do not call this method directly. * @param string $id session ID * @param string $data session data * @return boolean whether session write is successful */ public function writeSession($id, $data) { return (bool) $this->ssdb->setx($this->calculateKey($id), $data, $this->getTimeout()); }