riak教程 java_riak-java-client

楚德辉
2023-12-01

riak-java-client 是 Riak 的 Java 客户端开发类库,示例代码:

// create a client (see Configuration below in this README for more details)

IRiakClient riakClient = RiakFactory.pbcClient(); //or RiakFactory.httpClient();

// create a new bucket

Bucket myBucket = riakClient.createBucket("myBucket").execute();

// add data to the bucket

myBucket.store("key1", "value1").execute();

//fetch it back

IRiakObject myData = myBucket.fetch("key1").execute();

// you can specify extra parameters to the store operation using the

// fluent builder style API

myData = myBucket.store("key1", "value2").returnBody(true).execute();

// delete

myBucket.delete("key1").rw(3).execute();

 类似资料: