Public » MiniRedis Read More
Clone URL:  
Pushed to one repository · View In Graph Contained in tip

add setnx

Changeset 12d0c38bccca

Parent 8f8afbe56fc7

by Profile picture of Benjamin PollackBenjamin Pollack

Changes to one file · Browse files at 12d0c38bccca Showing diff from parent 8f8afbe56fc7 Diff from another changeset...

Change 1 of 1 Show Entire File miniredis.py Stacked
 
252
253
254
 
 
 
 
 
 
 
 
255
256
257
 
252
253
254
255
256
257
258
259
260
261
262
263
264
265
@@ -252,6 +252,14 @@
  self.log(client, 'SET %s -> %s' % (key, data))   return True   + def handle_setnx(self, client, key, data): + if key in client.table: + self.log(client, 'SETNX %s -> %s FAILED' % (key, data)) + return 0 + client.table[key] = data + self.log(client, 'SETNX %s -> %s' % (key, data)) + return 1 +   def handle_shutdown(self, client):   self.log(client, 'SHUTDOWN')   self.halt = True