.NET Client Library - Remove with CAS

Hi,
With regards to the .NET Client Library there doesn't appear to be an ExecuteRemove (or Remove) where a cas value can be specified, is removal conditional on a matching cas possible any other way?
Thanks,
Matt

1 Answer

« Back to question.

Hi Mike,
This isn't possible with the .NET client and isn't available (as far as I know) in other SDKs. Could you describe the use case you're working with? How would your app react to a scenario where a delete were attempted against a stale document? Could you use CAS and update the key's value to null and then delete it after a successful CAS update?
-- John

Hi John,
I think the ruby SDK might have this function, on the Github wiki, it has the example c.delete("foo", :cas => 8835713818674332672). It's not essential but I would like to use it to clean up unused keys. The use case is storing a collection of values in a json array, where values are added or deleted. I would like to delete the item once the array count is zero - but only if no new items have been added since I determined there was only one remaining item that is being deleted.
Best Regards,
Matt

Hey Matt,
That was a pretty straightforward addition to the client, so I added it to the planned 1.2.2 release (March 5th). The Jira for the ticket is open at http://www.couchbase.com/issues/browse/NCBC-229. I updated our Enyim fork with those new methods and the unit tests are at http://review.couchbase.org/#/c/24713/1/src/Couchbase.Tests/CouchbaseCli.... The code is already written, it just has to go through code review.
-- John