-
Notifications
You must be signed in to change notification settings - Fork 26
Description
TL;DR: Add a lightweight fallback saver that works on Redis without RediSearch / RedisJSON (e.g., AWS ElastiCache standard, Upstash, GCP Memorystore, older OSS). Uses only core commands; no infra changes for users.
Problem
AsyncShallowRedisSaver depends on RediSearch/RedisJSON via redisvl. On providers/environments without those modules (ElastiCache standard, Upstash w/out FT, Memorystore, older OSS <7.1), initialization fails during module capability checks.
Proposal
Introduce PlainAsyncShallowRedisSaver, a fallback using only core Redis primitives:
- Checkpoints/offsets:
HGET/HSET,ZADD,GET/SET - Per-thread lock:
SET key value NX PX <ttl>+ release viaEVAL(compare-and-del)
These commands are long-standing (e.g., EVAL since 2.6; SET NX/PX in the SET spec) and require no external modules.
Detection & Usage
Extend from_conn_string(...):
- Try the current module-based saver.
- If Search/JSON are absent:
- If
?fallback=plainorallow_plain=True→ use Plain variant. - Otherwise: auto-fallback with a warning (configurable).
- If
Provider Compatibility (Quick)
| Environment | Modules Available | Current Result | With Fallback |
|---|---|---|---|
| AWS ElastiCache (standard) | None | Fails | Works |
| Upstash (JSON only, no FT) | Partial (no RediSearch) | Fails | Works |
| Azure Cache (Enterprise tier) | Full (Search + JSON) | Works | Unchanged |
| GCP Memorystore (standard) | None | Fails | Works |
| Recent OSS w/ modules installed | Full | Works | Unchanged |
| Older OSS / no modules (<7.1) | None | Fails | Works |
Ask
Would maintainers be interested in this contribution? If so, I’d be happy to open the PR with the fallback implementation, minimal tests, and brief docs (factory flag + small compatibility table). If you prefer an explicit-flag-only approach (no auto-fallback) or different naming than PlainAsyncShallowRedisSaver, please advise and I’ll align the PR accordingly.