Skip to content

feat: add RedisMemoryStore backend#3

Open
zeroknowledge0x wants to merge 1 commit into
Carlos-Projects:mainfrom
zeroknowledge0x:feat/redis-memory-store
Open

feat: add RedisMemoryStore backend#3
zeroknowledge0x wants to merge 1 commit into
Carlos-Projects:mainfrom
zeroknowledge0x:feat/redis-memory-store

Conversation

@zeroknowledge0x

Copy link
Copy Markdown

Summary

Implements a Redis-backed MemoryStore for production deployments, as requested in #2.

Changes

  • src/memmark/store/redis_store.py: New RedisMemoryStore class extending MemoryStore
    • Connection pooling via redis-py
    • Configurable key prefix and TTL
    • Graceful error handling on connection failures
    • clear() and size() convenience methods
  • src/memmark/store/__init__.py: Converted store module to package (moved original store.py content here, exports RedisMemoryStore)
  • pyproject.toml: Added redis optional dependency group, added fakeredis to dev deps
  • tests/test_redis_store.py: 19 tests covering read/write/append/clear/size, TTL, corrupted data, connection errors, and initialization

Acceptance Criteria

  • RedisMemoryStore passes all MemoryStore interface tests
  • Works with default Redis config (localhost:6379)
  • Graceful error handling on connection failure
  • All tests pass (294 total) and lint is clean

Usage

from memmark.store import RedisMemoryStore

store = RedisMemoryStore(url="redis://localhost:6379/0", ttl=3600)
store.write([{"id": "m1", "content": "hello"}])
memories = store.read()

Install with: pip install memmark-agent[redis]

Closes #2

- Add RedisMemoryStore extending MemoryStore interface
- Support connection pooling, key prefixes, TTL
- Graceful error handling on connection failures
- Convert store module to package for clean organization
- Add redis as optional dependency
- Add 19 tests with fakeredis
- All existing tests pass (294 total)

Closes Carlos-Projects#2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[help wanted] Add RedisMemoryStore backend

1 participant