public final class StoreValue extends RiakCommand<StoreValue.Response,Location>
To store a value in Riak you supply a Location
and an object to store. The object may be an instance of RiakObject
or your own POJO. In the case of a POJO the default serialization uses the Jackson JSON library
to store your object as JSON in Riak.
Namespace ns = new Namespace("my_type","my_bucket");
Location loc = new Location(ns, "my_key");
RiakObject ro = new RiakObject();
ro.setValue(BinaryValue.create("This is my value"));
StoreValue sv =
new StoreValue.Builder(ro).withLocation(loc).build();
StoreValue.Response response = client.execute(sv);
All operations can called async as well.
...
RiakFuture<StoreValue.Response, Location> future = client.executeAsync(sv);
...
future.await();
if (future.isSuccess())
{
...
}
Modifier and Type | Class and Description |
---|---|
static class |
StoreValue.Builder
Used to construct a StoreValue command.
|
static class |
StoreValue.Option<T>
Options For controlling how Riak performs the store operation.
|
static class |
StoreValue.Response |
Modifier and Type | Method and Description |
---|---|
protected RiakFuture<StoreValue.Response,Location> |
executeAsync(RiakCluster cluster) |
execute
protected RiakFuture<StoreValue.Response,Location> executeAsync(RiakCluster cluster)
executeAsync
in class RiakCommand<StoreValue.Response,Location>
Copyright © 2014. All rights reserved.