https://github.com/svrana/gretis
:cyclone: An asynchronous Redis::Connection object using Greenlets and Tornado
https://github.com/svrana/gretis
cluster greenlet python redis redis-py redis-py-cluster tornado
Last synced: about 2 months ago
JSON representation
:cyclone: An asynchronous Redis::Connection object using Greenlets and Tornado
- Host: GitHub
- URL: https://github.com/svrana/gretis
- Owner: svrana
- License: mit
- Created: 2015-12-09T21:47:45.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2018-04-05T16:03:53.000Z (about 7 years ago)
- Last Synced: 2025-03-24T04:57:05.673Z (2 months ago)
- Topics: cluster, greenlet, python, redis, redis-py, redis-py-cluster, tornado
- Language: Python
- Homepage:
- Size: 26.4 KB
- Stars: 1
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# gretis
An asynchronous redis::Connection object using Greenlets and Tornado's event-loop.
## Requires
* [Tornado](https://github.com/tornadoweb/tornado)
* [Greenlet](https://github.com/python-greenlet/greenlet)## Installation
```bash
pip install gretis
```## Getting Started
With redis-py:
Create a redis ConnectionPool instructing it to use the Gretis AsyncConnection
as its connection. You must have a parent greenlet or you will get an
exception. (Examples assume you are in greenlet context already)```python
import redis
from gretis.async_connection import AsyncConnectionpool = redis.ConnectionPool(connection_class=AsyncConnection,
host='localhost', port=6379, db=0, socket_timeout=1)
r = redis.StrictRedis(connection_pool=pool)
r.set('foo', 'bar')```
Or with redis-cluster-py:
Create a redis cluster ConnectionPool and give it an AsyncClusterConnection.
```python
import redis
from gretis.async_cluster_connection import AsyncClusterConnection
from rediscluster import ClusterConnectionPool, StrictClusterRedispool = ClusterConnectionPool(connection_class=AsyncClusterConnection,
host='localhost', port=700, socket_timeout=1)
r = StrictRedisCluster(connection_pool=pool)
r.set('foo', 'bar')
```