CAS with non-existent key giving OK vs NOT_FOUND

If I submit a cas with a non-existent key I would expect to receive CASResponse.NOT_FOUND but am receiving CASResponse.OK instead. Is this a bug? The use case is a test we created for a cas operation on either a non-existent key or a key that has expired from the cache.

Couchbase Java client 1.2.0

cas operation used: public CASResponse cas(String key, long casId, int exp, Object value

test case:

String key = UUID.randomUUID().toString();
String value = "a value";
int documentTtl = 3600; // seconds
long cas = 0;

CASResponse response= client.cas(key, cas, documentTtl, value);

assert(response == CASResponse.NOT_FOUND);

Debugging shows the response to be OK instead of NOT_FOUND

1 Answer

« Back to question.

cas value of 0 == cas wildcard and match any cas value.