New Counters - client support

Sam Elliott sam.elliott at basho.com
Thu Jul 11 04:55:20 EDT 2013


On 11 Jul 2013, at 4:00AM, Y N <yug3sh at yahoo.com> wrote:

> Hi,
> 
> The counters stuff looks awesome.... can't wait to use it.
> 
> Is this already supported via the currently available clients (specifically, the Java 1.1.1 client)? 
> 
> Also, when can we expect some tutorial / documentation around using counters? I looked at the GitHub link, however, some use cases are not very clear (e.g. are all counters automatically initialized to 0? How do you initialize it to a different value)?

Hi

The tutorial/documentation will be out soon (just as soon as I polish up some details).

Counters are initialised to zero, but there is no "initialise" command. Instead, you send an increment operation, and internally the counter is initialised and the operation is applied to it. If you read a non-existent counter, you get not found.

So, to "initialise" to a different value, just send the increment operation to get it to the value you want.

NB: I've been referring to it as an "increment operation" but you can send negative values to decrement a counter. There is no separate operation to decrement.

Sam

> 
> Thanks.
> 
> 
> _______________________________________________
> riak-users mailing list
> riak-users at lists.basho.com
> http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com





More information about the riak-users mailing list