
Redis Semantic Cache
This wraps Redis Cloud's LangCache preview service so you can cache LLM responses by semantic similarity instead of exact string match. When a prompt comes in, it searches for similar embeddings and returns the cached answer if the cosine distance clears your threshold, skipping the model call entirely. Start at 0.9 for the threshold, crank it to 0.95+ if wrong answers hurt, or drop to 0.8 for looser matching on internal tools. The big gotcha is keeping task types separate. Don't let support queries and code questions share a cache or you'll serve nonsense. Split by cache ID or filter with custom attributes if you need finer isolation within one instance.
- skills.sh installs
- 2K
- GitHub stars
- 175
- last updated
- Aug 21, 2026
Install
$ npx -y skills add redis/agent-skills --skill redis-semantic-cache --agent claude-codeInstalls into .claude/skills of the current project.
Files
Redis Semantic Cache
Semantic caching for LLM responses with Redis Cloud's LangCache service. Stores prompts as embeddings; subsequent semantically-similar prompts return the cached response without re-calling the model.
LangCache is currently in preview on Redis Cloud. Features and behavior may change.
When to apply
- Wrapping an LLM call (OpenAI, Anthropic, etc.) with a cache layer to cut cost and latency.
- Caching RAG answers, classification outputs, or any deterministic LLM workload.
- Tuning the precision/hit-rate trade-off for a semantic cache.
- Splitting one application's LLM workloads across multiple cache instances.
1. The cache-aside flow
LangCache fits in front of any LLM call as a standard cache-aside pattern:
- Send the user's prompt to LangCache's
search. - Cache hit — return the stored response directly.
- Cache miss — call the LLM, then
setthe response so future similar prompts hit.
from langcache import LangCache
import os
lang_cache = LangCache(
server_url=f"https://{os.getenv('HOST')}",
cache_id=os.getenv("CACHE_ID"),
api_key=os.getenv("API_KEY"),
)
Sponsors
Details
- Repository
- github.com/redis/agent-skills
- Categories
- Backend & APIs, AI & Agent Building, Cloud & Infrastructure, Databases
- First seen
- Jul 14, 2026