Search code examples
javaaerospike

Optimistic locking in aerospike java


I was looking at example where one can take lock of a row in aerospike. Documents mentioned below says that it has support but can't find example form same.Can anybody please share method(s) which support these

Reference: https://docs.aerospike.com/display/V3/Key-Value+Store


Solution

  • You could do this by setting the appropriate attributes in the WritePolicy. For example, for our Java client, you can check the details here:

    http://www.aerospike.com/apidocs/java/com/aerospike/client/policy/WritePolicy.html

    You want to look at GenerationPolicy:

    http://www.aerospike.com/apidocs/java/com/aerospike/client/policy/GenerationPolicy.html

    Also note that our documentation has been updated and is now under http://www.aerospike.com/docs