示例#1
0
 /**
  * Stores item in Redis.
  *
  * @param \iveeCore\ICacheable $item to be stored
  *
  * @return boolean true on success
  */
 public function setItem(ICacheable $item)
 {
     $ttl = $item->getCacheExpiry() - time();
     if ($ttl < 1) {
         return false;
     }
     return $this->redis->setex($item->getKey(), $ttl, gzencode(serialize($item)));
 }
 /**
  * Stores item in Memcached.
  *
  * @param \iveeCore\ICacheable $item to be stored
  *
  * @return boolean true on success
  */
 public function setItem(ICacheable $item)
 {
     $ttl = $item->getCacheExpiry() - time();
     if ($ttl < 1) {
         return false;
     }
     return $this->memcached->set($item->getKey(), $item, $ttl);
 }