redis-semantic-cache
Skill by redis
Guides AI assistants through semantic caching of LLM responses with Redis LangCache on Redis Cloud. Useful for developers who want to cut LLM API cost and latency by reusing answers to similar prompts.
Install redis-semantic-cache
Built from the published package, never by AI.
git clone --depth 1 https://github.com/redis/agent-skills /tmp/agent-skills && mkdir -p ~/.claude/skills && cp -r /tmp/agent-skills/skills/redis-semantic-cache ~/.claude/skills/redis-semantic-cacheRun in your terminal. Claude Code loads skills from ~/.claude/skills automatically.
git clone --depth 1 https://github.com/redis/agent-skills /tmp/agent-skills && mkdir -p ~/.gemini/antigravity-cli/skills && cp -r /tmp/agent-skills/skills/redis-semantic-cache ~/.gemini/antigravity-cli/skills/redis-semantic-cacheAntigravity CLI loads skills from ~/.gemini/antigravity-cli/skills, or .agents/skills for one project.
Step-by-step: install redis-semantic-cache in Antigravity CLI
Skills can run scripts on your machine. Some need an API key: check the README.
About
This skill gives AI assistants guidance for semantic caching of LLM responses using LangCache on Redis Cloud. It stores prompts as embeddings, so semantically similar later prompts return a cached response instead of calling the model again. The guidance covers the cache-aside flow, where a search runs first and a set stores the response after a miss.
The skill explains how to call search and set through the SDK or the REST API, and how to tune the similarity threshold between 0.8 and 0.95. It recommends separate caches per task type, or custom attributes for filtering within one cache. It is aimed at developers caching OpenAI, Anthropic or similar LLM calls, RAG answers or classification outputs to reduce API cost and latency. LangCache is in preview, so behavior may change.
Written from the project's SKILL.md and checked against it.
What it can do
- Cache-aside flowShows how to search the cache first, then call the LLM and store the response on a miss.
- Search and set callsCovers calling search and set through the LangCache SDK or REST API.
- Similarity threshold tuningExplains how the threshold trades hit rate against precision, with suggested values.
- Separate caches per task typeAdvises using distinct cache IDs for different LLM workloads.
- Attribute-based filteringDescribes storing and searching with custom attributes to isolate subtopics in one cache.
What you need
- Redis Cloud account with a LangCache cache
- LangCache API key and cache ID
- Python with the LangCache SDK, as shown in the examples
Try asking
- Add a LangCache cache-aside layer in front of my OpenAI calls.
- Help me choose a similarity threshold for my FAQ cache.
- Split my app's LLM prompts into separate caches for support and code.
Good to know
- LangCache is in preview on Redis Cloud and behavior may change.
- Lower similarity thresholds raise hit rate but risk off-topic answers.
Security check
ANo download-and-run commands, hidden instructions or signs of sending keys out were found.
Checked automatically: skills/redis-semantic-cache/SKILL.md. This looks for known risky patterns and is not a full audit. How grades work
Inside the skill
-
SKILL.md4 KB -
references/best-practices.md2 KB -
references/langcache-usage.md2 KB
Alternatives to redis-semantic-cache
All alternatives →Creates, configures and manages datasets on the Hugging Face Hub, including SQL-based querying and transformation. Built for people who edit dataset content and metadata directly, alongside the HF MCP server.
Diagnoses and repairs gbrain's Postgres access when a command or MCP result shows a GBRAIN_DB_ACCESS marker, or when the operator reports the brain database is down. It runs the hardcoded gbrain db-repair ladder and verifies the result with a re-probe.
Manages clusters, instances, and backups for AlloyDB for PostgreSQL. Built for creating, configuring, and administering AlloyDB databases, not general PostgreSQL or Cloud SQL instances.
Writes, reviews and migrates Supabase logs queries against the ClickHouse logs table served by the logs.all.otel endpoint. Built for developers who write Logs Explorer SQL or convert older BigQuery logs queries.
Diagnoses and fixes slow Paperclip PostgreSQL queries using Cloud and Neon evidence, local benchmarks, regression tests, and a pull request with passing checks. Built for engineers working on Paperclip.
Guides AI assistants through Prisma 8 projects built on @prisma/orm-postgres, @prisma/orm-sqlite, or @prisma/orm-mongo. It covers data contracts, migrations, typed queries and runtime setup for developers on Prisma 8.
Compare with hugging-face-datasets, db-repair or alloydb-basics
redis-semantic-cache: common questions
What does the similarity threshold do in LangCache?
It sets how close a new prompt must be in embedding cosine distance to a cached prompt to count as a hit. Higher values require stricter matches and produce fewer false positives.
Should I use one cache or several for LLM workloads?
The source recommends separate caches per task type, since unrelated prompts can return wrong answers if they share a cache. Custom attributes can also isolate tasks within one cache.
Can I use LangCache without an SDK?
Yes. The source says the search and set operations are available through the REST API at the cache entries endpoints.
How do I install redis-semantic-cache?
Run the command above to copy the skill into ~/.claude/skills/. Claude Code picks it up automatically.
Is redis-semantic-cache free?
The code is published under the MIT licence. The service it connects to may have its own pricing.
Is redis-semantic-cache safe to use?
It scores 82 of 100. Grades: maintenance A, licence A, quality B. Security check: grade A, no risky patterns found in the files checked. Review the code before you install. How grades work.
What are alternatives to redis-semantic-cache?
Similar skills: hugging-face-datasets, db-repair, alloydb-basics, clickhouse-logs-queries.
