Skip to main content
TOREDIS
=======

This is minimalistic, but feature rich redis client for Tornado built on top of `hiredis <https://github.com/pietern/hiredis-py>`_ protocol parser.

Supports all redis commands, which are auto-generated from the redis `JSON documentation file <https://github.com/antirez/redis-doc/blob/master/commands.json>`_.

Key design points:

1. While toredis attempts to add some syntactical sugar to the API, all responses are returned "as is". For example, if command returns
list of items and developer requested only one key, list with one entry will be returned. For example::

def handle(self, result):
print(len(result))

conn.hkeys('test1', handle)


2. Most redis commands accept one or more keys. Toredis adds a bit of logic to handle single key or array of keys. Due to python
limitations, it is not possible to use ``*args`` with named ``callback`` argument, so you will have to pass array of key names::

# This will work
conn.blpop('test', callback=callback)
conn.blpop(['test', 'test2'], callback=callback)

# This won't work
conn.blpop('test', 'test2', callback=callback)


3. If redis connection will be dropped while waiting for response, callback will be triggered with `None` as a value.

4. Toredis does not provide reconnection feature, but you can override :meth:`~toredis.Client.on_disconnect` method and implement your reconnection logic.

You can find command `documentation here <https://github.com/mrjoes/toredis/blob/master/toredis/commands.py>`_ (will be moved to rtd later).

Pipelining is also supported::

# For more than one pipeline for connection create it with Pipeline(conn)
pipeline = conn.pipeline()
pipeline.set('foo', 'bar')
pipeline.get('foo')
pipeline.send(callback=callback)

For more examples please refer to tests.
More on `redis pipelining <http://redis.io/topics/pipelining>`_.

Things missing:

* Backport pure-python redis protocol parser (for PyPy support)
* Connection pools

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

yatoredis-0.1.6.tar.gz (13.3 kB view details)

Uploaded Source

File details

Details for the file yatoredis-0.1.6.tar.gz.

File metadata

  • Download URL: yatoredis-0.1.6.tar.gz
  • Upload date:
  • Size: 13.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for yatoredis-0.1.6.tar.gz
Algorithm Hash digest
SHA256 ecfe8d6ae291a71d8563524840b425c265b637dee852f1df22ae5ed04904952f
MD5 518ca7929aa28ad96abf885094144c5a
BLAKE2b-256 394da0c2aaacffe65cb4c7f1ca5c8a260c023b70aefe1ac852252a8e86d064a2

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1.6 This release

1 file

0.1.5

1 file

0.1.4

1 file

0.1.3

1 file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page