While some data may be static, other forms of data may need to be updated. This is also easy to do. Let's give the kv-pair we stored in value-3
a new associated value:
> (set new-value-3 (setelement 2 value-3 42))
#(value 42)
Now we can update the kv-pair stored in Riak:
> (set `#(ok ,result) (lric:get pid my-bucket key-3))
#(ok ...)
> (set updated-obj-3 (lrico:update-value result new-value-3))
#(riakc_obj ...)
> (set `#(ok ,new-result) (lric:put pid updated-obj-3 '(return_body)))
#(ok ...)
Let's verify:
> (binary_to_term (lrico:get-value new-result))
#(value 42)