Python wrapper for redis-rs
Project description
- Python wrapper for:
Features
Async client for single and cluster
Support typing
Encoding values to str, int, float
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:
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.6.6.tar.gz
(19.2 kB
view hashes)
Built Distributions
Close
Hashes for redis_rs-0.6.6-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2008e4416aeec3d4458a67563cdd77b11c329d46d5c7fe5f4176dba5c26b3c9f |
|
MD5 | 8c946fa06a586d11296f985c0a20d8f0 |
|
BLAKE2b-256 | f8f084af661a98c89782cd09391119855192b9489fd611666af8a7925ff55afb |
Close
Hashes for redis_rs-0.6.6-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6d9f866f3b950f9f9514ee5aace9ae87aff727ff9cc01bd80d07ad5fcc4473ff |
|
MD5 | a26f36f95d9ee5c895a97e3225322210 |
|
BLAKE2b-256 | 78d962c8b1846376c400f3b833b1f476754ca9aaaf4fa2df0c0121bfa9f89e8a |
Close
Hashes for redis_rs-0.6.6-pp38-pypy38_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 68f27257fb9732e6620dad7bcfcdbe8ca98e40b2fc23de2571a5f0fc53a454f6 |
|
MD5 | 5e248a861d267fd2f60f6fed5b825947 |
|
BLAKE2b-256 | 1168dccb56be58dc5ffb1bd769e2e23aecffd72b3e1abf2e40e5fb3dd1fa9222 |
Close
Hashes for redis_rs-0.6.6-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 184f0471eebdcb26ac83d35fa2050426186631a295b9157f87c03fb4863a1731 |
|
MD5 | 6a45aece2011c67ee696725577c991ae |
|
BLAKE2b-256 | 714b41f79d4014a3d0d5d5a04c93cdc68b4a32acb4bd705b9f9cd0e6256c6123 |
Close
Hashes for redis_rs-0.6.6-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2b03729e4597c7bfd0a5b567847ae916a4e55e4b6fe16d30e9424ba53564bb5a |
|
MD5 | d64236be9202ff940af32825e6d21b34 |
|
BLAKE2b-256 | 27d5242639eb31adb8a0c15abe72c560b097729608ddacab4368021a96f5104d |
Close
Hashes for redis_rs-0.6.6-cp311-cp311-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2a677dec8bf1fba2ccd68e17fcb2b2d149a0d20de9738822b5880e1b0a513c28 |
|
MD5 | 83759386c29919d89c90cbd8a5b4b990 |
|
BLAKE2b-256 | ed139998d14d07ed50ea6f0cd4972a104cae9d63256c4dc7376f8649aa248817 |
Close
Hashes for redis_rs-0.6.6-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 37dbf2c6853c68e1f5b0b668717f776b2fec0274d3c44dc46918a8a18995ea07 |
|
MD5 | 28c09b414912ad6af0ba547dda7fbe9e |
|
BLAKE2b-256 | 99afc9e04af192f5c7afce9e47c0028eaacaa97d514b7699b042728d61d0ec33 |
Close
Hashes for redis_rs-0.6.6-cp310-cp310-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b54b7374c86d789a58720139ab2d1e17a0fdc6586f0ab3ea6b91d060858e945e |
|
MD5 | f1de2d9d1385c5b81dfbf1a3d4f61eda |
|
BLAKE2b-256 | 296eadfc6eec55898d464e77f27262ba8de2cb1052bcd894d683e95a87b1596f |
Close
Hashes for redis_rs-0.6.6-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3156f8516140a215a5931c5c8c377065b621c2e224dfdb83d3ebfbfdf3f5a3fb |
|
MD5 | bfab72afdc6d50a44fd5cdf805176573 |
|
BLAKE2b-256 | 7f27c95ff991b6c5af01e8ab480825c4e77486d9d33d969b4bd2b61d6f429196 |
Close
Hashes for redis_rs-0.6.6-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 95348c389696f7f0e13249fa7b6eb94b56007405251586779811b2dd1821a6ea |
|
MD5 | a35a2648d6d210f69d77b3011029f149 |
|
BLAKE2b-256 | 199317f6a6cccb3d1d0ed21117b00ddecc1f012c41fc8b654f37dd1af5e01b8c |