Example #1
0
 /**
  * @param $key
  * @return null|mixed
  */
 public function get($key)
 {
     $file = $this->getFilename($key);
     if ($this->exists($file) && $this->valid($file)) {
         return $this->serializer->deserialize(file_get_contents($file));
     }
     return null;
 }
Example #2
0
 /**
  * Sets a cache entry
  *
  * @param $key
  * @param $value
  * @return void
  */
 public function set($key, $value)
 {
     $item = $this->pool->getItem($key);
     $item->set($this->serializer->serialize($value), $this->expire);
 }
Example #3
-1
 /**
  * Sets a cache entry
  *
  * @param $key
  * @param $value
  * @return void
  */
 public function set($key, $value)
 {
     if ($this->ttl === null) {
         $this->client->set($key, $this->serializer->serialize($value));
     } else {
         $this->client->set($key, $this->serializer->serialize($value), 'ex', $this->ttl);
     }
 }