What happen to CAS in PHP SDK?

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.

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

Hey @brett19 can you advise here?

Hey kchan4,

Try something like this:

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

Cheers, Brett

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