cas command always expects response STORED

Bug #684690 reported by Michal Linhard
6
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\r\n2\r" | nc test1 11211
STORED
$ echo -e "cas a 0 0 1 281479271678120\r\n2\r" | nc test1 11211
EXISTS
$ echo -e "cas b 0 0 1 281479271678120\r\n2\r" | nc test1 11211
NOT_FOUND

python-memcached client v1.45 doesn't support these

Revision history for this message
Sean Reifschneider (jafo) wrote :

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?

Changed in python-memcached:
status: New → Opinion
importance: Undecided → Medium
assignee: nobody → Michal Linhard (michal-linhard)
Revision history for this message
Michal Linhard (michal-linhard) wrote :

This will be quite a delayed answer :-)

Yeah I can understand that you don't want to change the cas() function API

the cas_status function/variable would work for me.
I'd save inthere whatever is now read by server.expect("STORED") in the _set function.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.