Need to lock a document using get and lock so that other threads dont make the same document again till the cleanup has been performed by first thread


#1

My goal is to make sure when one thread has created a document other threads are not able to create the same document again till the first thread has finished cleanup. I m using get and lock but its not working. The other threads are still creating the same documents before thread 1 has finished cleanup. Im using memcached buckets for storing docs.


#2

GETL (get and lock) only works on Couchbase buckets.


#3

@drigby So is there any way of a having a locking mechanism with memcached buckets?


#4

There’s no pessimistic locking in the memcached protocol (which memcache buckets implement). You can use optimistic locking with CAS instead, but that will require a different design in your application.


#5

@drigby Thanks. :slight_smile: