I am trying to come up with an elegant solution using couchbase that I think getAndLock is a good use case for.
I have a user record that exists. We have many application servers that all may need to access this user record update various properties and save it. This could happen in a highly concurrent, multi-server, multi-threaded environment.
The fetch/modify/update are all VERY short lived. Would using getAndLock() be a good use case for this? I would prefer to NOT have to worry about merging changes. The ideal is simply to not let another server/thread access the User by key if it is already being processed.
What is the behavior in the SDK when you issue a getAndLock() when the record is already locked? Does it block or return immediately with some type of predictable exception? The API doesn’t really give much clarification here.
Are there any major performance issues with a getAndLock design pattern?