/** * 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); } }
/** * @see InterfaceCache */ public function set($sKey, $mValue, $iTtl = 0) { return $this->_oSsdb->set($sKey, json_encode($mValue), $iTtl); }