Add Redis/SolidCache ephemeral caching layer for retrieval pipeline#18
Merged
LeahArmstrong merged 5 commits intomainfrom Feb 28, 2026
Merged
Add Redis/SolidCache ephemeral caching layer for retrieval pipeline#18LeahArmstrong merged 5 commits intomainfrom
LeahArmstrong merged 5 commits intomainfrom
Conversation
e12a4fd to
63f8a53
Compare
LeahArmstrong
pushed a commit
that referenced
this pull request
Feb 28, 2026
- view_template_extractor_spec: move mocks into `it` block with `a_string_matching` regex (aligns with PR #19 approach for cleaner merge) - CacheStore#fetch: expand YARD @note documenting nil-as-cache-miss semantic so custom backend implementers preserve the contract - SolidCacheStore#clear: log a warning when the backend lacks delete_matched instead of silently no-oping https://claude.ai/code/session_01V3fpEonNoFGNTRxFWpHST6
2 tasks
Introduces a backend-agnostic cache store abstraction with three backends (InMemory, Redis, SolidCache) that caches expensive operations across the retrieval pipeline and MCP sessions: - Embedding vectors cached by text hash (eliminates redundant API calls) - Pre-formatted LLM context cached by query+budget (zero recomputation) - CachedEmbeddingProvider decorator wraps any Provider::Interface - CachedRetriever decorator wraps Retriever with context-level caching - Builder auto-wires cache when cache_enabled config is true - 5 namespaced TTL domains (embeddings: 24h, context: 15min, etc.) - 40 new specs covering all cache stores, middleware, and edge cases https://claude.ai/code/session_01V3fpEonNoFGNTRxFWpHST6
- Remove dead structural_ttl param from CachedRetriever (accepted but never read — structural context is already cached as part of the full RetrievalResult, making a separate TTL unnecessary) - Add NOTE on CacheStore#fetch explaining nil-as-miss behavior https://claude.ai/code/session_01V3fpEonNoFGNTRxFWpHST6
- Extract partition_cached helper in CachedEmbeddingProvider to fix Metrics/MethodLength on embed_batch (22→13 lines) - Convert guard clause in SolidCacheCacheStore#clear - Remove redundant map(&:to_s) before join in cache_key - Fix line length in view_template_extractor_spec - Fix semicolon in cache_store_spec fetch block - Add Metrics/ClassLength disable to Builder (107/100 after cache methods) - Preserve block form for custom fetch (not Hash#fetch) with inline cop disable https://claude.ai/code/session_01V3fpEonNoFGNTRxFWpHST6
- view_template_extractor_spec: move mocks into `it` block with `a_string_matching` regex (aligns with PR #19 approach for cleaner merge) - CacheStore#fetch: expand YARD @note documenting nil-as-cache-miss semantic so custom backend implementers preserve the contract - SolidCacheStore#clear: log a warning when the backend lacks delete_matched instead of silently no-oping https://claude.ai/code/session_01V3fpEonNoFGNTRxFWpHST6
- Rename SolidCacheCacheStore to SolidCacheStore (stuttering name) - Raise ArgumentError on unknown cache_store config (matches other builders) - Add connection error resilience to Redis and SolidCache stores (read/exist? degrade to miss, write/delete log and return nil) - Handle corrupted JSON: delete bad key and return nil - Wrap cache writes in fetch/middleware with rescue so computed values are always returned even when cache backend is down - Add RedisCacheStore and SolidCacheStore specs with mock doubles
12485cd to
8f05e47
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Introduces a backend-agnostic cache store abstraction with three backends
(InMemory, Redis, SolidCache) that caches expensive operations across the
retrieval pipeline and MCP sessions:
https://claude.ai/code/session_01V3fpEonNoFGNTRxFWpHST6