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

add TYPE command

Changeset ed1817ad2e2c

Parent f1a16babefa1

by Profile picture of Benjamin PollackBenjamin Pollack

Changes to one file · Browse files at ed1817ad2e2c Showing diff from parent f1a16babefa1 Diff from another changeset...

Change 1 of 1 Show Entire File miniredis.py Stacked
 
318
319
320
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
321
322
323
 
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
@@ -318,6 +318,22 @@
  self.log(client, 'RPUSH %s %s' % (key, data))   return True   + def handle_type(self, client, key): + if key not in client.table: + return RedisMessage('none') + + data = client.table[key] + if isinstance(data, deque): + return RedisMessage('list') + elif isinstance(data, set): + return RedisMessage('set') + elif isinstance(data, dict): + return RedisMessage('hash') + elif isinstance(data, str): + return RedisMessage('string') + else: + return RedisError('unknown data type') +   def handle_quit(self, client):   client.socket.shutdown(socket.SHUT_RDWR)   client.socket.close()