Esempio n. 1
0
 /**
  * In addition to all writes being stored to $local, we'll also
  * keep get() values around ;).
  *
  * {@inheritdoc}
  */
 public function get($key, &$token = null)
 {
     $value = $this->transaction->get($key, $token);
     // only store if we managed to retrieve a value (valid token) and it's
     // not already in cache (or we may mess up tokens)
     if ($value !== false && $this->local->get($key, $localToken) === false && $localToken === null) {
         $this->local->set($key, $value);
     }
     return $value;
 }
Esempio n. 2
0
 /**
  * {@inheritdoc}
  */
 public function touch($key, $expire)
 {
     // grab existing value (from real cache or memory) and re-save (to
     // memory) with updated expiration time
     $value = $this->get($key);
     if ($value === false) {
         return false;
     }
     $success = $this->local->set($key, $value, $expire);
     if ($success === false) {
         return false;
     }
     $this->defer->touch($key, $expire);
     return true;
 }