Exemplo n.º 1
0
Arquivo: Redis.php Projeto: itkg/core
 /**
  * Set a value into the cache
  *
  * @param \Itkg\Core\CacheableInterface $item
  *
  * @return void
  */
 public function set(CacheableInterface $item)
 {
     $this->getConnection()->set($item->getHashKey(), $item->getDataForCache());
     if (null !== $item->getTtl()) {
         $this->getConnection()->expire($item->getHashKey(), $item->getTtl());
     }
 }
Exemplo n.º 2
0
 /**
  * Set a value into the cache
  *
  * @param \Itkg\Core\CacheableInterface $item
  *
  * @return void
  */
 public function set(CacheableInterface $item)
 {
     $this->values[$item->getHashKey()] = $item->getDataForCache();
 }
Exemplo n.º 3
0
 /**
  * Set a value into the cache
  *
  * @param CacheableInterface $item
  *
  * @return void
  */
 public function set(CacheableInterface $item)
 {
     $this->connection->set($item->getHashKey(), $item->getDataForCache(), $item->getTtl());
 }
Exemplo n.º 4
0
 /**
  * Set a value into the cache
  *
  * @param CacheableInterface $item
  *
  * @return void
  */
 public function set(CacheableInterface $item)
 {
     $targetFile = $this->getTargetFile($item->getHashKey());
     $cacheData = serialize($item->getDataForCache());
     if (!file_put_contents($targetFile, sprintf('%s%s;', self::STR_PREFIX, $cacheData))) {
         throw new \RuntimeException(sprintf('Unable to write cache file %s with data : %s', $targetFile, $cacheData));
     }
 }
Exemplo n.º 5
0
 /**
  * Set a value into the cache
  *
  * @param \Itkg\Core\CacheableInterface $item
  *
  * @return void
  */
 public function set(CacheableInterface $item)
 {
     $this->provider->save($item->getHashKey(), $item->getDataForCache(), $item->getTtl());
 }