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"])
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.7.0.tar.gz
(22.3 kB
view hashes)
Built Distributions
Close
Hashes for redis_rs-0.7.0-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 006c14114cffcbef671f28e06989f3c461e21a962179d788932c1ff47e111026 |
|
MD5 | 9e49a0a121d57727e2b771a820b6c679 |
|
BLAKE2b-256 | fb0d1352be1daaac88222febe1da59d43c98414efd68c274e746ff6ef5e407e1 |
Close
Hashes for redis_rs-0.7.0-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 54d7fefedfe66755679f46ff6913fadd3864cef96cadd2fffc7d2f9a01bf33a6 |
|
MD5 | 091d10f7463d290ba51e624a151f1b1e |
|
BLAKE2b-256 | b14a9819a8e4f810c862a4f8834ca39eda0f268dcc889742cfde115171e0d8bc |
Close
Hashes for redis_rs-0.7.0-pp38-pypy38_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 235d257461f44b461b61efa63184de8497001dc61be03154489b26ce1e942acd |
|
MD5 | 07d0d9a5c8aae6fe475d4ed1c8be20f0 |
|
BLAKE2b-256 | c157515c74e96119af6bd18adbcdcb192c4ba0db70ff91304a117356f46cc7e3 |
Close
Hashes for redis_rs-0.7.0-cp312-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 46783bdd28c1992af7a3351767b4741ee5ababe1858f6209bf402b4b97d3b4de |
|
MD5 | b204eb1b6b77b7e4369c31e4363cb0e1 |
|
BLAKE2b-256 | 3d71b4e86489c704e9cc0314855f65c6250315ebe5f79f80eff27249e1defb84 |
Close
Hashes for redis_rs-0.7.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9eaedf11e96eb43e46cdf5c56f4a19bbfa8261a769662afa833d4d5598fc0c4f |
|
MD5 | 8da4b717002040b0cf1ed1cdb42d6ca2 |
|
BLAKE2b-256 | c8b5bad21315eeb779b0d7f07fa40d63f0aa0210267cea027527c7fa04b29f3b |
Close
Hashes for redis_rs-0.7.0-cp311-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 708eecb584a43d69d8e0764d14335d50cfd2b3876b24df93c3f923aeb5b58dba |
|
MD5 | f0b999d8bfcfbdd9728002c18c84d6bb |
|
BLAKE2b-256 | e4993230e16825c7e067b4bd70aa5806a54030bfefa4515a6a0d5b259762ae42 |
Close
Hashes for redis_rs-0.7.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1b0b9e08819e47d1a76a691dc128683b397012098e73a3ac46af62ba13d13367 |
|
MD5 | 1686694cd57c08f5afb09cff08488e1d |
|
BLAKE2b-256 | 8345f25e8619ffb2faed4e0d793105efabdc081b2e3cbaabeb4fb50814ddc941 |
Close
Hashes for redis_rs-0.7.0-cp311-cp311-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 751d92862d875ee3ba84289a5e3bf9bd84494ceb9ed8813509362e7b9a4cda48 |
|
MD5 | 5ccb19bbac2d1a161fa259d26dbfd1b5 |
|
BLAKE2b-256 | e2c2a89c928e80f21b1edfa4049e01ff5f92ce8343376868c514f284ab2a83a5 |
Close
Hashes for redis_rs-0.7.0-cp310-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 09d27d8e4d6d4b695c502c1c119c49af3afa7ce72250879595b29682e5a63429 |
|
MD5 | 5965450596e37c6ec10737e5932e63f6 |
|
BLAKE2b-256 | e6f37ba8cc877ac6587c3edea14fd10126f3f9c87564c9c17768086ca2f09426 |
Close
Hashes for redis_rs-0.7.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3d10f10a4e2b0adf0d291764fa54c3a73045e275779553a959d84b2079469b50 |
|
MD5 | 26bc0e10c6a24344e7fadfc86abd5725 |
|
BLAKE2b-256 | 4d9f861836db648f5df65944af03ad7f59613dd2b5ad0689a9f534dcdd4fa5a6 |
Close
Hashes for redis_rs-0.7.0-cp310-cp310-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3bcf813deed9e141041dd29710557ecae86b161e937a218d29e8471d7f974c5e |
|
MD5 | 7c1af6296393386c5c845581e029914a |
|
BLAKE2b-256 | c4380443d402c71b0b292bfcf8672f55c339ee1cb2c08f6fcd6ee9093f799285 |
Close
Hashes for redis_rs-0.7.0-cp39-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a87b15cb886a307146b540f30b42bcb3e9ed45eabfb99b27b641128f25b7646f |
|
MD5 | 4d03ca65297046d69fe785568d35d6a5 |
|
BLAKE2b-256 | 060818ae0681bb217e66286179ef1cb034620e2eaf385a3052db2493759a0b3c |
Close
Hashes for redis_rs-0.7.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ec65a0ec39a1a31390276f552203d470c8ca3841a2d38716b7a13b94aff201d6 |
|
MD5 | 942039b9a5c639deaed25a29ead3cbf1 |
|
BLAKE2b-256 | d05b9b76987e1ae6d637d418f6b5bc8a75edab368d4acb2c6aa32613b1f2db63 |
Close
Hashes for redis_rs-0.7.0-cp38-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a81bd320ba9dbf3157d094f3029b8c023edd2995730be1b0e8d30b7b9069891e |
|
MD5 | 1b375da113116fc4b5d69ff25e13d041 |
|
BLAKE2b-256 | d5e0d02a0f1334cdae69f42e5dbe542bdaf64c6132993a180a76e1f83d9b6a60 |
Close
Hashes for redis_rs-0.7.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3230f93f0e5c8fb46a4fb8eb8ed83c60af3ab52eb2fc958f06bb98ea5b43eec3 |
|
MD5 | 322faa3022b1bd4f675dd21a5e9c3064 |
|
BLAKE2b-256 | 1f0c31a96b2171c5afe72e0b17504ddfd5b6b47462a49e2c6ce0e89142105c10 |