cas command always expects response STORED
Bug #684690 reported by
Michal Linhard
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Python Memcached |
Opinion
|
Medium
|
Michal Linhard |
Bug Description
memcached cas command can also result in response EXISTS and NOT_FOUND
see the following scenario:
$ echo -e "set a 0 0 1\r\n1\r" | nc test1 11211
STORED
$ echo -e "gets a\r" | nc test1 11211
VALUE a 0 1 281479271678120
1
END
$ echo -e "cas a 0 0 1 281479271678120
STORED
$ echo -e "cas a 0 0 1 281479271678120
EXISTS
$ echo -e "cas b 0 0 1 281479271678120
NOT_FOUND
python-memcached client v1.45 doesn't support these
To post a comment you must log in.
I can see that you would like EXISTS and NOT_FOUND could be useful to distinguish in this case, but the cas() function is documented to return non-zero on success. I'd half say this should be a different function, like cas_status() or something, that would return the 3 different values (SUCCESS, EXISTS and NOT_FOUND). I'd be reluctant to change the main cas() function, without comment from the wider group of users. Or maybe it could be some special class that tests 0/non-0, but also has methods for these extra status.
Comments?