Skip to main content

Async Redis connection object using Greenlets and Tornado

Project description

An asynchronous redis::Connection object using Greenlets and Tornado’s event-loop.

Requires

Installation

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)

import redis
from gretis.async_connection import AsyncConnection

pool = 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.

import redis
from gretis.async_cluster_connection import AsyncClusterConnection
from rediscluster import ClusterConnectionPool, StrictClusterRedis

pool = ClusterConnectionPool(connection_class=AsyncClusterConnection,
    host='localhost', port=700, socket_timeout=1)
r = StrictRedisCluster(connection_pool=pool)
r.set('foo', 'bar')

Project details


Download files

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

Source Distribution

gretis-0.0.11.tar.gz (5.1 kB view details)

Uploaded Source

File details

Details for the file gretis-0.0.11.tar.gz.

File metadata

  • Download URL: gretis-0.0.11.tar.gz
  • Upload date:
  • Size: 5.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for gretis-0.0.11.tar.gz
Algorithm Hash digest
SHA256 077afd68e7bcc05d3c91a2b57cc311bd2390b7cbdad103fab12d6e9722966338
MD5 38f6bb6dca028b18a7964247f7efb143
BLAKE2b-256 0fc2a956c4dd59a14783107ec63e308cd3b0c917191a1bc928a14daa88a3f04b

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page