I am trying to implement a highly concurrent access pattern where every request should get a unique document when they do a get.
I can't use N1QL
and I dont have key to do KV fetch.
I implemented an array of documents and as Arrays.asList(remove(0))
is a thread safe call, every parallel thread should be able to remove the rolling 0th element of the array, making sure, no 2 threads remove the same element.
This is working fine with concurrent thread. However, now problem is, that as every thread also wants to use the document content retrieved, I am not seeing any method to deserialize the removed element and read the content.
Remove call doesn't return the element as such.
Any guidance/pointers will be appreciated.
Here is my code snippet:
MutateInResult resultDet = collection.mutateIn("TestDoc", Arrays.asList(remove("[0]")));
Thanks Naved