Asynchronous Redis client that works within Tornado IO loop.
This is basically a fork of brükva redis client slightly modified to work with tornado.gen interface instead of adisp.
import tornadoredis
import tornado.web
import tornado.gen
...
c = tornadoredis.Client()
c.connect()
...
class MainHandler(tornado.web.RequestHandler):
@tornado.web.asynchronous
@tornado.gen.engine
def get(self):
foo = yield tornado.gen.Task(c.get, 'foo')
bar = yield tornado.gen.Task(c.get, 'bar')
zar = yield tornado.gen.Task(c.get, 'zar')
self.set_header('Content-Type', 'text/html')
self.render("template.html", title="Simple demo", foo=foo, bar=bar, zar=zar)
Run redis-server on localhost:6379. Run tests with the following command:
python -m tornado.testing tornadoredis.tests
Reconnect tests have been disabled by default.
brukva is developed and maintained by Konstantin Merenkov
See LICENSE file. Long story short: WTFPL v2