todo: replace this with real redis client

def repl(host,port):
  "todo: replace this with real redis client"
  client=redis.StrictRedis(host,port,socket_timeout=0.1) # timeout is for pubsub -- it shares the connection_pool
  pubsub=client.pubsub()
  snt=SubNotifyThread(host,port); snt.start()
  while 1:
    try: command=raw_input('command> ') # this has up/down command history on windows. How?
    except KeyboardInterrupt: print 'ctrl+c'; break
    if command=='exit': break
    if not command: continue
    toks=command.split()
    try: f=dict(get=client.get,set=client.set,pub=client.publish,sub=snt.subscribe,unsub=snt.unsubscribe,ping=client.ping)[toks[0]]
    except KeyError: print 'unk_command %s'%toks[0]; continue
    try: print f(*toks[1:])
    except Exception as e: print 'error %s %s'%(e.__class__.__name__,str(e))
  snt.dead=True
  print 'waiting for pubsub thread'
  snt.join()