What happen to CAS in PHP SDK?

#1

Recently I was reading Check and Set (CAS) and learnt that instead of locking the document, we would use the CAS value to check if someone has updated the document before my update.
http://docs.couchbase.com/couchbase-devguide-2.5/#check-and-set-cas

But I read all over the PHP 2.07 API documentation, there is no CAS related method…
Although I can see CAS value still in the CouchbaseMetaDoc.
So… how to do we use it?

My imagination is that I will do a Set with my CAS value, if it fail it will gives me Exception…

Thanks in Advance

#2

Hey @brett19 can you advise here?

#3

Hey kchan4,

Try something like this:

$document = $bucket->get('key');
$newvalue = "Franklyn";
$bucket->replace('key', $newvalue, array('cas'=>$document->cas));

Cheers, Brett

#4

Sorry for the late reply! (very late…)
But its working! Thanks!

Cheers,
King