Lock and Unlock Document

Hi,
I would like to implement a Scheduler Lock, while 2 different jobs are running and trying to retrieve a document.
If document unlocked, it should lock it, do some work and unlock.
If other job tries to access that document at the same time, it will be rejected, because already locked by the first one.

What is the proper way to do that?
I am trying to implement StorageBasedLockProvider class, but missing the information asked above.

It would be nice to get some example.

Thank you in advance

Hi @moranr76. We do have locking semantics in Couchbase, e.g. you can get-and-write-lock a doc for a set period of time (up to 30 secs). The documentation is here, hope that helps.