Skip to main content

Python async client for Redis key-value store

Project description

docs codecov Latest Version in PyPI ci Supported Python versions

coredis is an async redis client with support for redis server, cluster & sentinel.

Installation

To install coredis:

$ pip install coredis

or from source:

$ python setup.py install

Getting started

Single Node client

import asyncio
from coredis import Redis

async def example():
    client = Redis(host='127.0.0.1', port=6379, db=0)
    await client.flushdb()
    await client.set('foo', 1)
    assert await client.exists(['foo']) == 1
    await client.incr('foo')
    await client.incrby('foo', increment=100)

    assert int(await client.get('foo')) == 102
    await client.expire('foo', 1)
    await asyncio.sleep(0.1)
    await client.ttl('foo')
    await asyncio.sleep(1)
    assert not await client.exists(['foo'])

asyncio.run(example())

Cluster client

 import asyncio
 from coredis import RedisCluster

 async def example():
     client = RedisCluster(host='172.17.0.2', port=7001)
     await client.flushdb()
     await client.set('foo', 1)
     await client.lpush('a', [1])
     print(await client.cluster_slots())

     await client.rpoplpush('a', 'b')
     assert await client.rpop('b') == b'1'

asyncio.run(example())
# {(10923, 16383): [{'host': b'172.17.0.2', 'node_id': b'332f41962b33fa44bbc5e88f205e71276a9d64f4', 'server_type': 'master', 'port': 7002},
# {'host': b'172.17.0.2', 'node_id': b'c02deb8726cdd412d956f0b9464a88812ef34f03', 'server_type': 'slave', 'port': 7005}],
# (5461, 10922): [{'host': b'172.17.0.2', 'node_id': b'3d1b020fc46bf7cb2ffc36e10e7d7befca7c5533', 'server_type': 'master', 'port': 7001},
# {'host': b'172.17.0.2', 'node_id': b'aac4799b65ff35d8dd2ad152a5515d15c0dc8ab7', 'server_type': 'slave', 'port': 7004}],
# (0, 5460): [{'host': b'172.17.0.2', 'node_id': b'0932215036dc0d908cf662fdfca4d3614f221b01', 'server_type': 'master', 'port': 7000},
# {'host': b'172.17.0.2', 'node_id': b'f6603ab4cb77e672de23a6361ec165f3a1a2bb42', 'server_type': 'slave', 'port': 7003}]}

To see a full list of supported redis commands refer to the Command compatibility documentation

Project details


Release history Release notifications | RSS feed

Download files

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

Source Distribution

coredis-3.5.0.tar.gz (166.0 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

coredis-3.5.0-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (211.7 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64manylinux: glibc 2.5+ x86-64

coredis-3.5.0-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl (211.6 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ i686manylinux: glibc 2.5+ i686

coredis-3.5.0-cp310-cp310-macosx_10_9_x86_64.whl (204.5 kB view details)

Uploaded CPython 3.10macOS 10.9+ x86-64

coredis-3.5.0-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (211.6 kB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64manylinux: glibc 2.5+ x86-64

coredis-3.5.0-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl (211.4 kB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ i686manylinux: glibc 2.5+ i686

coredis-3.5.0-cp39-cp39-macosx_10_9_x86_64.whl (204.5 kB view details)

Uploaded CPython 3.9macOS 10.9+ x86-64

coredis-3.5.0-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (212.1 kB view details)

Uploaded CPython 3.8manylinux: glibc 2.17+ x86-64manylinux: glibc 2.5+ x86-64

coredis-3.5.0-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl (212.0 kB view details)

Uploaded CPython 3.8manylinux: glibc 2.17+ i686manylinux: glibc 2.5+ i686

coredis-3.5.0-cp38-cp38-macosx_10_9_x86_64.whl (204.5 kB view details)

Uploaded CPython 3.8macOS 10.9+ x86-64

File details

Details for the file coredis-3.5.0.tar.gz.

File metadata

  • Download URL: coredis-3.5.0.tar.gz
  • Upload date:
  • Size: 166.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.9.12

File hashes

Hashes for coredis-3.5.0.tar.gz
Algorithm Hash digest
SHA256 d3837bafe4c354a598da1741d2daa97370939a781cc141c5c84cd18e94667675
MD5 2067cce71a1eb2a8e961838157e2a4de
BLAKE2b-256 9ebf517ed68343ea79ffd47451fe10377355fb36859bef604c61b31ff64a3e4c

See more details on using hashes here.

File details

Details for the file coredis-3.5.0-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for coredis-3.5.0-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 9293e4522691ebc83bd218d576bfe14e1c581830a53248ba55c4bd32958805e1
MD5 0d00a71b5c4e01bba96e97fc62ca8741
BLAKE2b-256 27b64de1bc8f81a88a9b9cedd1d8856866204c8e7913cd8c450f215de91d10d4

See more details on using hashes here.

File details

Details for the file coredis-3.5.0-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl.

File metadata

File hashes

Hashes for coredis-3.5.0-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 9a991cb0bdaccaf7bd7b94e8aeeeba0acaa8f635478b2b68f802af5fc8e97bd6
MD5 83fc4f9a951cbed4274a5da78a057f7d
BLAKE2b-256 52b35390995d19afa06ef16f1a37b9b29e46586452681322795c4451d15fc8db

See more details on using hashes here.

File details

Details for the file coredis-3.5.0-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for coredis-3.5.0-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 bcffbd6f268c766e51fd30e7251402c5e60e4eac1ec028b7af49808c6f75a798
MD5 032f97dbe1358a4fcb1e514b4b007266
BLAKE2b-256 e099d7e5a689a2407f261583ca50d56c7ec222c40e1b12399a4fd0b80f6ab134

See more details on using hashes here.

File details

Details for the file coredis-3.5.0-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for coredis-3.5.0-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 4ca34240c48307b7c9cd13f55415dba6556a957ea1ee6252b4bd51d7b4eeaa05
MD5 340801a20489e75cb93b68193df55724
BLAKE2b-256 2958c2ec8615d86ba882fccf464cf9453bd57e48f0c39443de0713ff0b88be16

See more details on using hashes here.

File details

Details for the file coredis-3.5.0-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl.

File metadata

File hashes

Hashes for coredis-3.5.0-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 5707d8380bfab8a3d1072a2f40cb68c9a0d2ff77d24971c25b63418a89f1b805
MD5 7b360703e89249ba74dba5793acfd3b4
BLAKE2b-256 ac5ed2472c12e57c2ae4c5c1d2463a7b88c79ff55a8e4cb571f8cf51c5ec679d

See more details on using hashes here.

File details

Details for the file coredis-3.5.0-cp39-cp39-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for coredis-3.5.0-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 b86f3717d3ef119b097cad001c37ac7d4d20836af477cfef224f0b3fc281d7c3
MD5 e8fccd5a718a0d1ae9a9b9fbb8ef87a4
BLAKE2b-256 6e154d54777ca00fee14d63bfe638981201b9502554b0cbeb6e0b737d3b18bce

See more details on using hashes here.

File details

Details for the file coredis-3.5.0-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for coredis-3.5.0-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 9bfc588b96dddf13896a48bb9d040a307c64f3974ac4526c243793e58bd9e03c
MD5 2d70477c5ca2b0e99fa3ab3de4cf47bc
BLAKE2b-256 2506708cd81f52d12e774d3c763fd942e8d4378db312b485e77a1c005786b253

See more details on using hashes here.

File details

Details for the file coredis-3.5.0-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl.

File metadata

File hashes

Hashes for coredis-3.5.0-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 fc92c27df2b0efc8fbd7918e8306e81842bac54eaf2a66e760a063f2126a18e1
MD5 0981b01ce30ed40e45fd83450de10304
BLAKE2b-256 9a4c00bb6d3b25820d371d965df204beccfc9c8e2ed87f1854edfaba74e6b307

See more details on using hashes here.

File details

Details for the file coredis-3.5.0-cp38-cp38-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for coredis-3.5.0-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 f78f93ec4feb754e3f005dc1138ca07530cce5728d6c9bdfce9e56a0d94a8a5f
MD5 0e5bc2d91e5e82dae97f0d5da9f6a4f7
BLAKE2b-256 de5f257647c949c3545c90c02f634a4284c2e95f294e194052f3cda50510f4c1

See more details on using hashes here.

Supported by

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