Esempio n. 1
0
 /**
  * Returns a cached value based on it's key
  *
  * This returns a cached value in the form of an object. This object will allow
  * you to run an update on the value with the clause that it shouldn't be
  * changed if it has changed since it was retrieved. This can be used to
  * prevent race conditions.
  *
  * @param String $key The value to retrieve
  * @return \r8\Cache\Result
  */
 public function getForUpdate($key)
 {
     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');
     }
     $result = $this->cache->getForUpdate($this->modifyKey($key));
     return new \r8\Cache\Result($this, $key, $result->getHash(), $result->getValue());
 }