Skip to main content

gredis

gRedis is an asynchronous client library of Redis written with Tornado coroutine.

gRedis is standing on the shoulders of giants:

Installation

pip install gredis

OR

easy_install gredis

OR

git clone https://github.com/coldnight/gredis
cd gredis
python setup.py install

Usage

from tornado import gen
from tornado import web
from gredis.client import AsyncRedis

client = AsyncRedis("ip.or.host", 6379)

class DemoHandler(web.RequestHandler):

    @gen.coroutine
    def get(self):
        ret = yield client.incr("key")
        redis = client.to_blocking_client()
        ret2 = redis.incr("key")
        self.write(str(ret + ret2))

Pub/Sub

from tornado import gen
from tornado import web
from gredis.client import AsyncRedis

client = AsyncRedis("ip.or.host", 6379)

class PubSubHandler(web.RequestHandler):

    @gen.coroutine
    def get(self):
        pubsub = client.pubsub()
        channel = "test"
        yield pubsub.subscribe(channel)
        response = yield pubsub.get_message(True)
        assert response["type"] == "subscribe"
        response = yield pubsub.get_message(True)
        assert response["type"] == "message"
        self.write(response['data'])

    @gen.coroutine
    def post(self):
        yield client.publish(channel, "test")

Not Implementation

  • pipeline

Metadata

Release files for gredis 0.0.9

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for gredis 0.0.9
File Size Uploaded
gredis-0.0.9.tar.gz 5.5 kB Details

Release files / gredis-0.0.9.tar.gz

Download URL gredis-0.0.9.tar.gz
Size 5.5 kB
Tags Source
SHA-256 checksum
How to use checksums
0b1e65e77cba2dfd1dda5a91e0a6e672478b343e004918dc95b1743ac118ceed
BLAKE2b-256 checksum
How to use checksums
7df0fe6722590ad3b65ce0834b7eb50e2f5bdc78fd5724d4437ca03f329a0c34
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.0.9 This release

1 release file

0.0.8

1 release file

0.0.7

2 release files

0.0.6

0.0.5

0.0.3

0.0.2

0.0.1

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