diff options
author | Sean Reifschneider <jafo@tummy.com> | 2010-12-15 23:09:44 -0700 |
---|---|---|
committer | Sean Reifschneider <jafo@tummy.com> | 2010-12-15 23:09:44 -0700 |
commit | 81933bc299740b7f10253abd439a719424d506fc (patch) | |
tree | 4cb03bbae64fb26bf9bd51776502123536acc38a /memcache.py | |
parent | 1a4cefd414b108b4c172445d13c67c80a13b492e (diff) | |
download | python-memcached-81933bc299740b7f10253abd439a719424d506fc.tar.gz |
Delete result code checking.
Diffstat (limited to 'memcache.py')
-rw-r--r-- | memcache.py | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/memcache.py b/memcache.py index bb10c03..c533d16 100644 --- a/memcache.py +++ b/memcache.py @@ -389,12 +389,14 @@ class Client(local): try: server.send_cmd(cmd) - server.expect("DELETED") + line = server.readline() + if line and line.strip() in ['DELETED', 'NOT_FOUND']: return 1 + self.debuglog('Delete expected DELETED or NOT_FOUND, got: %s' + % repr(line)) except socket.error, msg: if isinstance(msg, tuple): msg = msg[1] server.mark_dead(msg) - return 0 - return 1 + return 0 def incr(self, key, delta=1): """ @@ -653,7 +655,6 @@ class Client(local): time, store_info[1], store_info[2])) else: notstored.append(prefixed_to_orig_key[key]) - server.send_cmds(''.join(bigcmd)) server.send_cmds(''.join(bigcmd)) except socket.error, msg: if isinstance(msg, tuple): msg = msg[1] @@ -1144,6 +1145,11 @@ if __name__ == "__main__": print "OK" else: print "FAIL"; failures = failures + 1 + print "Checking results of delete ..." + if mc.get("long") == None: + print "OK" + else: + print "FAIL"; failures = failures + 1 print "Testing get_multi ...", print mc.get_multi(["a_string", "an_integer"]) |