Difference between upsert and repalce in PHP SDK


After researching how to use CAS, I’ve learned that I need to use replace($ids, $val, $options) method in the PHP SDK. I have a couple of questions.

  1. How come there’s not ‘cas’ option for upsert? Isn’t replace and upsert basically the same, except the fact that replace accepts ‘cas’? Is upsert faster than replace?

  2. This is not PHP SDK question, but how come check and set is not default? Don’t people want consistency by default?

Here’s what I know by testing:

The method replace() will throw an error if the key does not exist, upsert() is like “add or replace”.