Summary
Build Caffeine cache infrastructure to optimize performance and reduce LLM provider costs. This includes caching for embeddings, provider responses, and semantic search results.
🏛️ Caching Layers
1. Embedding Cache (embeddingCache)
- Key: SHA-256(text + model)
- Value:
float[] vector
- TTL: 24h
2. LLM Response Cache (llmResponseCache)
- Key: Hash(system_prompt + user_input + params)
- Value: String response
- TTL: 1h
3. Search Cache (searchCache)
- Key: Hash(query + topK + threshold)
- Value:
List<SearchResult>
- TTL: 10m (with eviction on memory store)
✅ Acceptance Criteria
🚀 Contributor Guidance
- Add
spring-boot-starter-cache and caffeine to pom.xml.
- Create
com.spectrayan.spector.synapse.config.CacheConfig.
- Update
SynapseProperties to include spector.cache.* settings.
- Apply annotations to
LlmBridge and MemoryService.
RICE-C Score
| Factor |
Score |
Rationale |
| Reach |
3/5 |
Performance improvement |
| Impact |
2x |
Latency reduction |
| Effort |
M |
~2 days |
Summary
Build Caffeine cache infrastructure to optimize performance and reduce LLM provider costs. This includes caching for embeddings, provider responses, and semantic search results.
🏛️ Caching Layers
1. Embedding Cache (
embeddingCache)float[]vector2. LLM Response Cache (
llmResponseCache)3. Search Cache (
searchCache)List<SearchResult>✅ Acceptance Criteria
CaffeineCacheManageris configured with dedicated specs for each cache type.LlmBridgeandMemoryServiceuse Spring's@Cacheableannotations.GET /api/v1/system/cache/statsreturns hit/miss rates and eviction counts.POST /api/v1/system/cache/clearinvalidates all caches.🚀 Contributor Guidance
spring-boot-starter-cacheandcaffeinetopom.xml.com.spectrayan.spector.synapse.config.CacheConfig.SynapsePropertiesto includespector.cache.*settings.LlmBridgeandMemoryService.RICE-C Score