Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a0e9fc28d6 |
@@ -14,19 +14,19 @@ datastore trio (`redis` / `psql` / `mysql`), a sibling of the `mongo` lib.
|
|||||||
`requirements.txt`:
|
`requirements.txt`:
|
||||||
|
|
||||||
```
|
```
|
||||||
redis_store @ git+ssh://git@git.rethinkstudios.io/rethink-public/redis.git@v0.1.1
|
redis_store @ git+ssh://git@git.rethinkstudios.io/rethink-public/redis.git@v0.1.2
|
||||||
```
|
```
|
||||||
|
|
||||||
Direct:
|
Direct:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
pip install "redis_store @ git+ssh://git@git.rethinkstudios.io/rethink-public/redis.git@v0.1.1"
|
pip install "redis_store @ git+ssh://git@git.rethinkstudios.io/rethink-public/redis.git@v0.1.2"
|
||||||
```
|
```
|
||||||
|
|
||||||
Pulls `redis>=5` (redis-py, which ships the asyncio client — **not** the dead standalone
|
Pulls `redis>=5` (redis-py, which ships the asyncio client — **not** the dead standalone
|
||||||
`aioredis`).
|
`aioredis`).
|
||||||
|
|
||||||
Drop the `@v0.1.1` suffix from the line above to install the latest unpinned.
|
Drop the `@v0.1.2` suffix from the line above to install the latest unpinned.
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
@@ -62,6 +62,10 @@ One client/pool per process — build it once, attach it to your app (`app.kv =
|
|||||||
`None` for an absent key). Pass `decode_responses=False` at construction for raw `bytes`.
|
`None` for an absent key). Pass `decode_responses=False` at construction for raw `bytes`.
|
||||||
Counters and counts (`incr`/`decr`/`exists`/`ttl`) always return `int` regardless.
|
Counters and counts (`incr`/`decr`/`exists`/`ttl`) always return `int` regardless.
|
||||||
|
|
||||||
|
Pool sizing/timeout are `max_connections=` and `pool_timeout=` (how long a caller waits for
|
||||||
|
a free connection when the pool is saturated). Pass the driver's own `timeout=` in
|
||||||
|
`pool_kwargs` and construction raises a clear `ValueError` — use `pool_timeout=`.
|
||||||
|
|
||||||
## Error contract — fail loud
|
## Error contract — fail loud
|
||||||
|
|
||||||
Unlike the `mongo` lib (which log-and-swallows, returning a safe default), **this lib
|
Unlike the `mongo` lib (which log-and-swallows, returning a safe default), **this lib
|
||||||
|
|||||||
+1
-1
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
|
|||||||
|
|
||||||
[project]
|
[project]
|
||||||
name = "redis_store"
|
name = "redis_store"
|
||||||
version = "0.1.1"
|
version = "0.1.2"
|
||||||
description = "async redis wrapper over redis-py asyncio with a raw escape hatch, fail-loud and config-free"
|
description = "async redis wrapper over redis-py asyncio with a raw escape hatch, fail-loud and config-free"
|
||||||
requires-python = ">=3.10"
|
requires-python = ">=3.10"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
|||||||
@@ -71,7 +71,16 @@ class RedisDB:
|
|||||||
max_connections, callers WAIT up to pool_timeout seconds for a free connection
|
max_connections, callers WAIT up to pool_timeout seconds for a free connection
|
||||||
(matching motor/mongo's blocking pool) rather than the plain pool's behavior of
|
(matching motor/mongo's blocking pool) rather than the plain pool's behavior of
|
||||||
raising MaxConnectionsError immediately. pool_timeout=None waits forever.
|
raising MaxConnectionsError immediately. pool_timeout=None waits forever.
|
||||||
|
|
||||||
|
`timeout` is the pool's own kwarg (set from pool_timeout here), so passing it in
|
||||||
|
pool_kwargs would collide — reject it with a clear pointer rather than let the
|
||||||
|
driver raise a cryptic "multiple values for 'timeout'".
|
||||||
"""
|
"""
|
||||||
|
if "timeout" in pool_kwargs:
|
||||||
|
raise ValueError(
|
||||||
|
"redis_store: pass the pool wait timeout as pool_timeout=, not timeout= "
|
||||||
|
"(timeout is filled from pool_timeout)"
|
||||||
|
)
|
||||||
self._pool = redis.BlockingConnectionPool(
|
self._pool = redis.BlockingConnectionPool(
|
||||||
host=host,
|
host=host,
|
||||||
port=port,
|
port=port,
|
||||||
|
|||||||
Reference in New Issue
Block a user