How to use the KV_INCR_KEY
?
I found a useful feature in gwan api, but without any sample.
I want to add items to the KV store with this as primary key.
Also, how to get the value of this key?
The KV_INCR_KEY
value is a flag intended to be passed to k_add()
.
You get the newly inserted key's value by checking the return value of k_add()
. The documentation states:
kv_add(): add/update a value associated to a key
return: 0:out of memory, else:pointer on existing/inserted kv_item struct
This was derived from an idea discussed on the G-WAN forum. And, like for some other flags (timestamp or persistence, for example), it has not not been implemented yet (KV_NO_UPDATE
is functional).
Since what follows the next version (focussed on new scripted languages) is a kind of zero-configuration mapReduce
, the KV store will get more attention soon.