Permalink
Browse files

incr/decr return None on server connection fail.

  • Loading branch information...
1 parent 0910559 commit c5459d4ae83b838ffd555af8b0b1b2e3a9d3e3c4 Sean Reifschneider committed Mar 29, 2013
Showing with 5 additions and 2 deletions.
  1. +3 −0 ChangeLog
  2. +2 −2 memcache.py
View
@@ -1,3 +1,6 @@
+ * incr/decr return None instead of 0 on server connection failure.
+ Suggested by Ivan Virabyan
+
* Supports IPv6 connections using: "inet6:[fd00::32:19f7]:11000".
Patch by Romain Courteaud
View
@@ -484,7 +484,7 @@ def decr(self, key, delta=1):
returns 0, not -1.
@param delta: Integer amount to decrement by (should be zero or greater).
- @return: New value after decrementing.
+ @return: New value after decrementing or None on error.
@rtype: int
"""
return self._incrdecr("decr", key, delta)
@@ -493,7 +493,7 @@ def _incrdecr(self, cmd, key, delta):
self.check_key(key)
server, key = self._get_server(key)
if not server:
- return 0
+ return None
self._statlog(cmd)
cmd = "%s %s %d" % (cmd, key, delta)
try:

0 comments on commit c5459d4

Please sign in to comment.