3
# Copyright (c) 2008 Drew Smathers
4
# See LICENSE for details.
8
from twisted.internet import reactor, defer
10
from txmemcache import client
14
# python -m examples/simple.py hostx:portx[,hosty:porty,...] <command> [args]
18
# python -m examples/simple.py localhost:11211,localhost:21212 set k hello
20
servers = [ (a.split(':')[0],int(a.split(':')[1]))
21
for a in sys.argv[1].split(',') ]
25
@defer.inlineCallbacks
27
proxy = client.MultiClientProxy(servers, urlencode=True)
28
yield proxy.connectTCP(timeout = 2)
29
result = yield getattr(proxy, command)(*args)
30
print 'Result:', result
34
reactor.callLater(0.5, run)