Skip to content

Commit c07ffa1

Browse files
author
raylu
committed
remove mixpanel-specific comments, fix .delete
1 parent 124f739 commit c07ffa1

File tree

3 files changed

+12
-13
lines changed

3 files changed

+12
-13
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*.pyc

memcache.py

+11-11
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,13 @@ def __init__(self, msg, item):
2929
super(ValidationException, self).__init__(msg, item)
3030

3131
class Client(object):
32-
3332
'''Simple memcache client that supports timeout and a few transparent retry scenarios'''
3433

3534
def __init__(self, host, port, timeout=None, connect_timeout=None):
36-
"""If connect_timeout is None, timeout will be used instead (for connect and everything else)."""
35+
'''
36+
If connect_timeout is None, timeout will be used instead
37+
(for connect and everything else).
38+
'''
3739
self._addr = (host, port)
3840
self._timeout = timeout
3941
self._connect_timeout = connect_timeout
@@ -156,18 +158,14 @@ def close(self):
156158
self._socket.close()
157159
self._socket = None
158160

159-
def delete(self, key, time=0):
160-
# req - delete <key> [<time>] [noreply]\r\n
161+
def delete(self, key):
162+
# req - delete <key> [noreply]\r\n
161163
# resp - DELETED\r\n
162164
# or
163-
# NOT_STORED\r\n
165+
# NOT_FOUND\r\n
164166
key = self._validate_key(key)
165-
if not isinstance(time, int):
166-
raise ValidationException('time not int', time)
167-
elif time < 0:
168-
raise ValidationException('time negative', time)
169167

170-
command = 'delete %s %d\r\n' % (key, time)
168+
command = 'delete %s\r\n' % key
171169
resp = self._send_command(command)
172170
if resp != 'DELETED\r\n' and resp != 'NOT_FOUND\r\n':
173171
raise ClientException('delete failed', resp)
@@ -250,8 +248,10 @@ def set(self, key, val, exptime=0):
250248
if resp != 'STORED\r\n':
251249
raise ClientException('set failed', resp)
252250

253-
# additional_args passed verbatim to the stats cmd
254251
def stats(self, additional_args=None):
252+
'''
253+
additional_args passed verbatim to the stats cmd
254+
'''
255255
# req - stats [additional args]\r\n
256256
# resp - STAT <name> <value>\r\n (one per result)
257257
# END\r\n

test.py

-2
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,6 @@
3535
except ImportError:
3636
import unittest
3737

38-
# buildbot's sysctl specifies ephemeral ports as 11212 - 65535
39-
# and memcached uses 11211 so we use 11000 - 11210
4038
low_port = 11000
4139
high_port = 11210
4240
# spin up new memcached instance to test against

0 commit comments

Comments
 (0)