Exemplo n.º 1
0
 public function saveBlogPost(BlogPostInterface $blog)
 {
     $identifier = $blog->getIdentifier();
     $blogJson = json_encode($blog, JSON_PRETTY_PRINT);
     $obj = new Object($identifier);
     $obj->setContent($blogJson);
     $obj->setContentType('application/json');
     try {
         $this->bucket->put($obj);
     } catch (RiakException $ex) {
         // Retry
         $this->bucket->put($obj);
     }
 }
Exemplo n.º 2
0
 /**
  * Create a new Riak object that will be stored as plain text/binary.
  * @param  string $key - Name of the key.
  * @param  object $data - The data to store.
  * @param  string $content_type - The content type of the object. (default 'text/json')
  * @return Object
  */
 public function newBinary($key, $data, $content_type = 'text/json')
 {
     $obj = new Object($this->client, $this, $key);
     $obj->setData($data);
     $obj->setContentType($content_type);
     $obj->jsonize = FALSE;
     return $obj;
 }