Skip to content

jkbrzt/tornado-redis

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Tornado-Redis

Asynchronous Redis client for the Tornado Web Server.

This is a fork of brükva redis client modified to be used via Tornado's native 'tornado.gen' interface instead of 'adisp' call dispatcher.

Tornado-Redis is licensed under the Apache Licence, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0.html).

Installation

To install:

python setup.py build
sudo python setup.py install

Tornado-Redis has been tested on Python 2.6 and 2.7.

You may also install it using pip or easy_install with:

pip install tornado-redis

or

easy_install install tornado-redis

Usage

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)

Running Tests

The redis server must be started on the default (:6379) port.

Use this command to run the test suite:

python -m tornado.testing tornadoredis.tests

'Autoreconnect' feature tests have been disabled by default. To enable them open the tornadoredis/test/init.py file and remove the '#' character from the line looking like this:

# from reconnect import ReconnectTestCase

Make sure you've configured redis-server to drop client connections by timeout before running reconnect tests.

Credits and Contributors

The brukva project has been started by Konstantin Merenkov but seem to be not maintained any more.

evilkost

mattd

maeldur

jbochi

The Tornado-Redis project's source code and 'tornado-redis' PyPI package are maintained by leporo.

Tornado is an open source version of the scalable, non-blocking web server and and tools that power FriendFeed. Documentation and downloads are available at http://www.tornadoweb.org/

About

Asynchronous Redis client that works within Tornado IO loop.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%