/**
  * {@inheritDoc}
  */
 public function find($storageName, $key)
 {
     $bucket = $this->client->bucket($storageName);
     /** @var $object \Riak\Object */
     $object = $bucket->get($key);
     if (!$object->exists()) {
         throw new NotFoundException();
     }
     return $object->getData();
 }
Beispiel #2
0
 public function testMetaData()
 {
     $client = new Client($GLOBALS['RIAK_HOST'], $GLOBALS['RIAK_PORT']);
     $bucket = $client->bucket("metatest");
     # Set some meta
     $bucket->newObject("metatest", array("foo" => 'bar'))->setMeta("foo", "bar")->store();
     # Test that we load the meta back
     $object = $bucket->get("metatest");
     $this->assertEquals("bar", $object->getMeta("foo"));
     # Test that the meta is preserved when we rewrite the object
     $bucket->get("metatest")->store();
     $object = $bucket->get("metatest");
     $this->assertEquals("bar", $object->getMeta("foo"));
     # Test that we remove meta
     $object->removeMeta("foo")->store();
     $anotherObject = $bucket->get("metatest");
     $this->assertNull($anotherObject->getMeta("foo"));
 }