@@ -29,11 +29,13 @@ def __init__(self, msg, item):
29
29
super (ValidationException , self ).__init__ (msg , item )
30
30
31
31
class Client (object ):
32
-
33
32
'''Simple memcache client that supports timeout and a few transparent retry scenarios'''
34
33
35
34
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
+ '''
37
39
self ._addr = (host , port )
38
40
self ._timeout = timeout
39
41
self ._connect_timeout = connect_timeout
@@ -156,18 +158,14 @@ def close(self):
156
158
self ._socket .close ()
157
159
self ._socket = None
158
160
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
161
163
# resp - DELETED\r\n
162
164
# or
163
- # NOT_STORED \r\n
165
+ # NOT_FOUND \r\n
164
166
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 )
169
167
170
- command = 'delete %s %d \r \n ' % ( key , time )
168
+ command = 'delete %s\r \n ' % key
171
169
resp = self ._send_command (command )
172
170
if resp != 'DELETED\r \n ' and resp != 'NOT_FOUND\r \n ' :
173
171
raise ClientException ('delete failed' , resp )
@@ -250,8 +248,10 @@ def set(self, key, val, exptime=0):
250
248
if resp != 'STORED\r \n ' :
251
249
raise ClientException ('set failed' , resp )
252
250
253
- # additional_args passed verbatim to the stats cmd
254
251
def stats (self , additional_args = None ):
252
+ '''
253
+ additional_args passed verbatim to the stats cmd
254
+ '''
255
255
# req - stats [additional args]\r\n
256
256
# resp - STAT <name> <value>\r\n (one per result)
257
257
# END\r\n
0 commit comments