Example #1
0
 /**
  * {@inheritdoc}
  */
 protected function doContains($id)
 {
     try {
         // We only need the HEAD, not the entire object
         $input = new Input\GetInput();
         $input->setReturnHead(true);
         $response = $this->bucket->get($id, $input);
         // No objects found
         if (!$response->hasObject()) {
             return false;
         }
         $object = $response->getFirstObject();
         // Check for expired object
         if ($this->isExpired($object)) {
             $this->bucket->delete($object);
             return false;
         }
         return true;
     } catch (Exception\RiakException $e) {
         // Do nothing
     }
     return false;
 }
Example #2
0
 /**
  * {@inheritdoc}
  */
 protected function doContains($id)
 {
     try {
         $input = new Input\GetInput();
         $input->setReturnHead(true);
         $response = $this->bucket->get(urlencode($id), $input);
         // No objects found
         if (!$response->hasObject()) {
             return false;
         }
         $object = $response->getFirstObject();
         if ($this->isExpired($object)) {
             return false;
         }
         return true;
     } catch (Exception\RiakException $e) {
         // Do nothing
     }
     return false;
 }