Example #1
0
 /**
  * @inheritdoc
  */
 public function get($key, $useCas = false)
 {
     $Result = $useCas ? $this->getConnection()->get($key, null, $this->casToken) : $this->getConnection()->get($key);
     if ($this->getConnection()->getResultCode() == Memcached::RES_SUCCESS) {
         $Item = new Item($key);
         $Item->unserialize($Result);
         return $Item;
     } else {
         return new Item($key);
     }
 }
Example #2
0
 /**
  * @inheritdoc
  */
 public function get($key, $useCas = false)
 {
     if ($useCas) {
         $this->watched = (bool) $this->getClient()->watch($key);
     }
     $result = $this->getClient()->get($key);
     if (!is_null($result)) {
         $Item = new Item($key);
         $Item->unserialize($result);
         return $Item;
     } else {
         return new Item($key);
     }
 }
Example #3
0
 /**
  * @inheritdoc
  * @throws ConnectException when redis instance unavailable
  */
 public function get($key, $useCas = false)
 {
     if ($useCas) {
         $this->watched = $this->getConnection()->watch($key);
     }
     try {
         $result = $this->getConnection()->get($key);
         if ($result !== false) {
             $Item = new Item($key);
             $Item->unserialize($result);
             return $Item;
         } else {
             return new Item($key);
         }
     } catch (KeyNotFoundException $Ex) {
         return new Item($key);
     }
 }