Python wrapper for redis-rs
Project description
- Python wrapper for:
Features
Async client for single and cluster
Support typing
Encoding values from str, int, float
Decoding values to str, int, float, list, dict
Install
pip install redis-rs
Using
import asyncio
import redis_rs
async def main():
async with redis_rs.create_client(
"redis://redis-node001",
"redis://redis-node002",
max_size=1,
cluster=True,
) as x:
info = await x.execute("INFO", "SERVER", encoding="info")
print(info["redis_version"])
# parse value as json
print(await x.get("foo", encoding="json"))
print(await x.execute(b"HSET", "fooh", "a", b"asdfg"))
print(await x.fetch_int("HSET", "fooh", "b", 11234567890))
print(await x.fetch_int("HGET", "fooh", "b"))
print(await x.fetch_str("HGET", "fooh", "a"))
print(await x.fetch_dict("HGETALL", "fooh", encoding="utf-8"))
print(await x.hgetall("fooh", encoding="utf-8"))
print(await x.execute("CLUSTER", "NODES"))
print(await x.fetch_bytes("GET", "foo"))
print(await x.fetch_int("GET", "foo"))
print(await x.execute("HGETALL", "fooh"))
print(await x.execute("ZADD", "fooz", 1.5678, "b"))
print(await x.fetch_scores("ZRANGE", "fooz", 0, -1, "WITHSCORES"))
print(x.status())
stream = "redis-rs"
print("x.xadd", await x.xadd(stream, "*", {"a": "1234", "d": 4567}))
print("x.xadd", await x.xadd(stream, items={"a": "1234", "d": 4567}))
print("x.xadd", await x.xadd(stream, {"a": "1234", "d": 4567}))
print("x.xadd", await x.xadd(stream, "*", "a", "1234", "d", 4567))
print("x.xadd", await x.xadd(stream, "a", "1234", "d", 4567))
print("xadd", await x.fetch_str("XADD", stream, "*", "a", "1234", "d", 4567))
print("xread", await x.execute("XREAD", "STREAMS", stream, 0))
print("xread", await x.fetch_dict("XREAD", "STREAMS", stream, 0, encoding="int"))
print("x.xread", await x.xread({stream: 0}, encoding="int"))
print("x.xread", await x.xread(stream, id=0, encoding="int"))
print("x.xread", await x.xread(stream, stream))
asyncio.run(main())
Development
cargo fmt
cargo clippy
maturin develop
or use hatch envs:
hatch run fmt
hatch run check
hatch run build
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
redis_rs-0.11.1.tar.gz
(33.9 kB
view hashes)
Built Distributions
Close
Hashes for redis_rs-0.11.1-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6209b400d508c675030f198ad2fd0039111beb2905dbb033d673af54bbff1eaa |
|
MD5 | fcf6fec179e4c9313bf02e3df95c0e91 |
|
BLAKE2b-256 | c49dc4ee8c07328de79296c5b7bf4b4a984d0daa9d5e129c1601b3c3b7b210a4 |
Close
Hashes for redis_rs-0.11.1-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c6d62eca4321dd0a5122a2a55c51e63f3b6da4e30ec3bfd46d25301657c13387 |
|
MD5 | 5e40265e79a832531017bdd44480cbce |
|
BLAKE2b-256 | 564a19c9156bd91134cee895a3eda4c753463db382ef6f4f14285e2642e5f8f1 |
Close
Hashes for redis_rs-0.11.1-pp38-pypy38_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 84c652c33e27b41ca9a30b817ca3b760b36e735e403fe8164105cdd69c064291 |
|
MD5 | 5838ea47cebce5602a4c2cfb59c2fcc1 |
|
BLAKE2b-256 | 92dd571b8cd319d4cc02d0a06f63803a07b92e4d559f62146e82e8ec466cd00d |
Close
Hashes for redis_rs-0.11.1-cp312-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e3625e8fb667853f52f10626efe8d614ba1b1ba2ec3097c1dde691b93750c051 |
|
MD5 | f50bbfadaccb3acc07306a3f5593a06c |
|
BLAKE2b-256 | aab357155ca45b7f78b86385376c1bb86ecb2be3e6266f6b9d477cf292e61d76 |
Close
Hashes for redis_rs-0.11.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 734e8fc0505b10da14bfabbcf36ceeb29bd345ef8cc1c11e053222f7ebe75ace |
|
MD5 | 467d91090538cdf5938693ede6958996 |
|
BLAKE2b-256 | 9aa28477533b3c7e7de04cf0df588e315afaf3d4f6e0726c747eee37906c90f8 |
Close
Hashes for redis_rs-0.11.1-cp311-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9279d8cd02d86ad9f054ec98ad371081f922f798b220e8cb633f555b42e85233 |
|
MD5 | 73a200603ac8bb84bdeffc594884e5c6 |
|
BLAKE2b-256 | 0501c29f0809eb6ea06be486ca44bcd4ad0f85ecdafaecc76e3fb0cc4afee337 |
Close
Hashes for redis_rs-0.11.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 46f0da33be395881c09f2db0fc005a8e2cdcfad3a6dd560e62ba11ad3cc3e3c2 |
|
MD5 | bd2aea316fd345554db1234974c648b0 |
|
BLAKE2b-256 | 75664196c7f0d17ebb60ec0f1586c024101814ffba74bf5b428da8da2aafb491 |
Close
Hashes for redis_rs-0.11.1-cp311-cp311-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ad425c99aef2a17f51fab72b36366bfdf3fe18c1e9d49ae25628504e6c062677 |
|
MD5 | 8d509d51c469eb52d1996a63a2103448 |
|
BLAKE2b-256 | 734a8a5766276959dea42f49f93229157cdf18ebaf9a312338cd2dcdcedfc579 |
Close
Hashes for redis_rs-0.11.1-cp310-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d7297e13c5f43d365893a25e8bfedd0ab9df5ac00a8bf8253b22a19be35ebb99 |
|
MD5 | d0aac63189ac4ad842650c756e541b66 |
|
BLAKE2b-256 | 4ce90a79ba63a1f0c416e1df09a6be53c2175bebc614ebb8d618b00dd2216cb9 |
Close
Hashes for redis_rs-0.11.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a23f32c0925142ba18039376dd1c161b5f11740243b97020f6871e32bc20c9e1 |
|
MD5 | 2fa0f214ca93edafa3b0dabc8a771b9a |
|
BLAKE2b-256 | 29d452cf8e5be365c24eed954e6cf98ea5071d3ab0bb3904510589ba2aabf4f8 |
Close
Hashes for redis_rs-0.11.1-cp310-cp310-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | dcf807a01406c3dd7fc51aa4df217eaff5656277446af464ed8f99275c0a82b4 |
|
MD5 | 07b6aa9346f04e25da0c4f6dda08e8a4 |
|
BLAKE2b-256 | a185d7b3acf254a4efa74ea949769ad717fb26edf5ec6cf10424387fc0549f4b |
Close
Hashes for redis_rs-0.11.1-cp39-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4b39f57b5f60eaabf92ce35a6969e941a28ab0c30b7b867e9b5836648b888097 |
|
MD5 | 4288faccf2da947bc757c2f38a300dc0 |
|
BLAKE2b-256 | 57eaa3698776a5b98331f2c79ace713cae8a935b15c901689d2190653ab8e38a |
Close
Hashes for redis_rs-0.11.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ed3fd7c69cab9fd969ac136763d4ae921793ec70c56ea217e5bd3912b96efa5c |
|
MD5 | 268bb5e346e8d126684c06cd54151463 |
|
BLAKE2b-256 | 578f204289f4abf3cfbdb35608635f96ccccdf40061b980462f92356d5a8c167 |
Close
Hashes for redis_rs-0.11.1-cp38-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 71c4cae45fa7d1b38e583639c5a97786aeb0b08ff013fb2febf676a969af83be |
|
MD5 | f479ab53ab7e9a5a2ff3984913ec71f7 |
|
BLAKE2b-256 | 04659499db6983fca2bcdf401e70badc8a4a5f843a0de90ac86ea7a190c792af |
Close
Hashes for redis_rs-0.11.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a6b6caa44dbd4387335ffac1bd02387afbfeef5763c3c6210457785c62b44fe4 |
|
MD5 | 3b2f977acd66e49eafe3f1ea2bf2b1c9 |
|
BLAKE2b-256 | 15cc50531089a9f5b464b69dfcb7016715e00f1267aeb548dd71b1a771303b0c |