Exemplo n.º 1
0
 /**
  * Sets the value for this key only if the value hasn't changed in the cache
  * since it was originally pulled
  *
  * @param \r8\Cache\Result $result A result object that was returned by
  *      the getForUpdate method
  * @param mixed $value The value to set
  * @param Integer $expire The lifespan of this cache value, in seconds
  * @return \r8\iface\Cache Returns a self reference
  */
 public function setIfSame(\r8\Cache\Result $result, $value, $expire = 0)
 {
     if (!$this->cache instanceof \r8\iface\Cache\Updatable) {
         throw new \r8\Exception\Data($this->cache, 'Inner Cache', 'Must be an instance of \\r8\\iface\\Cache\\Updatable');
     }
     $this->cache->setIfSame(new \r8\Cache\Result($this->cache, $this->modifyKey($result->getKey()), $result->getHash(), $result->getValue()), $value, $expire);
     return $this;
 }
Exemplo n.º 2
0
 /**
  * Deletes all values in the cache
  *
  * @return \r8\Cache\Suffix Returns a self reference
  */
 public function flush()
 {
     $this->inner->flush();
     return $this;
 }
Exemplo n.º 3
0
 /**
  * Deletes all values in the cache
  *
  * @return \r8\Cache\Layered Returns a self reference
  */
 public function flush()
 {
     $this->primary->flush();
     $this->secondary->flush();
     return $this;
 }
Exemplo n.º 4
0
 /**
  * Sets the value for this key only if the value hasn't changed in the cache
  * since it was originally pulled
  *
  * @param mixed $value The new value
  * @param Integer $expire The lifespan of this cache value, in seconds
  * @return \r8\Cache\Result Returns a self reference
  */
 public function setIfSame($value, $expire = 0)
 {
     $this->cache->setIfSame($this, $value, $expire);
     return $this;
 }
Exemplo n.º 5
0
 /**
  * Decrements this value by one
  *
  * @return \r8\Cache\Value Returns a self reference
  */
 public function decrement()
 {
     $this->cache->decrement($this->key);
     return $this;
 }