Skip to content

Implement semantic cache persistence to disk #47

@aviralgarg05

Description

@aviralgarg05

Description

The current semantic cache implementation stores cached queries only in memory. Implement persistence to disk so cached embeddings and results survive application restarts.

Proposed Solution

  • Save cache entries to a JSON or pickle file periodically
  • Load cached entries on SemanticCache initialization
  • Add configurable cache file path via environment variable
  • Implement cache expiration/TTL mechanism

Acceptance Criteria

  • Cache persists across application restarts
  • Configurable cache file location
  • Automatic loading of existing cache on startup
  • Optional TTL-based cache expiration
  • Unit tests for persistence functionality

Technical Notes

  • Similar pattern to Q-table persistence in rl_agent.py
  • Consider using joblib for efficient numpy array serialization
  • Add cache size limits to prevent unbounded growth

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions