You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
BREAKING CHANGE: This release introduces significant performance improvements
that change the internal storage format and key structure. Checkpoints created
with earlier versions are incompatible with v0.1.0.
Key performance improvements:
- Replace some FT.SEARCH operations with sorted sets for write tracking
- Add checkpoint-based key registry eliminating expensive SCAN/KEYS operations
- Implement multi-level caching for frequently accessed keys and data
- Optimize batch operations with pipelined Redis commands
- Add lazy TTL refresh to reduce unnecessary operations
- Improve index schemas for better query performance
Architectural changes:
- New CheckpointKeyRegistry tracks writes per checkpoint using sorted sets
- Cached key generation methods reduce string concatenation overhead
- Batch loading methods for pending writes and sends
- Optimized get_tuple with direct document access patterns
- Improved TTL management with threshold-based refresh
Testing improvements:
- Add comprehensive test coverage for new registry functionality
- Test TTL behaviors, caching mechanisms, and error paths
- Add integration tests for blob handling and metadata operations
- Improve test isolation using unique thread IDs instead of flushdb
The new architecture provides:
- 50-70% reduction in Redis operations for typical workflows
- Better scalability with checkpoint-scoped write tracking
- Reduced memory footprint through efficient caching
- Improved cluster mode compatibility
-`shallow.py` / `ashallow.py`: Shallow variants that store only latest checkpoint
124
+
-`key_registry.py`: Checkpoint key registry using sorted sets for efficient write tracking
125
+
-`scan_utils.py`: Utilities for efficient key scanning and pattern matching
50
126
51
127
**Stores** (`langgraph/store/redis/`):
52
128
@@ -56,17 +132,26 @@ make clean # Remove cache and build artifacts
56
132
57
133
### Key Architecture Patterns
58
134
59
-
**Dual Implementation Strategy**: Each major component has both sync and async variants that share common base classes. The base classes (`BaseRedisSaver`, `BaseRedisStore`) contain the bulk of the business logic, while concrete implementations handle Redis client management and specific I/O patterns.
135
+
**Dual Implementation Strategy**: Each major component has both sync and async variants that share common base classes.
136
+
The base classes (`BaseRedisSaver`, `BaseRedisStore`) contain the bulk of the business logic, while concrete
137
+
implementations handle Redis client management and specific I/O patterns.
60
138
61
-
**Redis Module Dependencies**: The library requires RedisJSON and RediSearch modules. Redis 8.0+ includes these by default; earlier versions need Redis Stack. All operations use structured JSON storage with search indices for efficient querying.
139
+
**Redis Module Dependencies**: The library requires RedisJSON and RediSearch modules. Redis 8.0+ includes these by
140
+
default; earlier versions need Redis Stack. All operations use structured JSON storage with search indices for efficient
141
+
querying.
62
142
63
-
**Schema-Driven Indexing**: Both checkpoints and stores use predefined schemas (`SCHEMAS` constants) that define Redis Search indices. Checkpoint indices track thread/namespace/version hierarchies; store indices support both key-value lookup and optional vector similarity search.
143
+
**Schema-Driven Indexing**: Both checkpoints and stores use predefined schemas (`SCHEMAS` constants) that define Redis
144
+
Search indices. Checkpoint indices track thread/namespace/version hierarchies; store indices support both key-value
145
+
lookup and optional vector similarity search.
64
146
65
-
**TTL Integration**: Native Redis TTL support is integrated throughout, with configurable defaults and refresh-on-read capabilities. TTL applies to all related keys (main document, vectors, writes) atomically.
147
+
**TTL Integration**: Native Redis TTL support is integrated throughout, with configurable defaults and refresh-on-read
148
+
capabilities. TTL applies to all related keys (main document, vectors, writes) atomically.
66
149
67
-
**Cluster Support**: Full Redis Cluster support with automatic detection and cluster-aware operations (individual key operations vs. pipelined operations).
150
+
**Cluster Support**: Full Redis Cluster support with automatic detection and cluster-aware operations (individual key
151
+
operations vs. pipelined operations).
68
152
69
-
**Type System**: Heavy use of generics (`BaseRedisSaver[RedisClientType, IndexType]`) to maintain type safety across sync/async variants while sharing implementation code.
153
+
**Type System**: Heavy use of generics (`BaseRedisSaver[RedisClientType, IndexType]`) to maintain type safety across
154
+
sync/async variants while sharing implementation code.
70
155
71
156
### Redis Key Patterns
72
157
@@ -82,10 +167,36 @@ Tests are organized by functionality:
0 commit comments