redis-semantic-cache
Redis LangCache guidance for semantic caching of LLM responses on Redis Cloud — calling search/set via the SDK or REST API, tuning the similarity threshold…
Skill by Redis, Inc.Official
Install
Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.
npx agentmarket install skill/redis-redis-semantic-cache
Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.
Get the weekly diff
The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.
About
Use cases: backend, ml, productivity
Reviews
Write a reviewNo reviews yet. Installed it? Reviews come from verified installers only. How reviews work
Permissions
What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.
- Tools
- No tools found
- Secrets
- None asked for
- Install scripts
- None found
Network hosts it talks to 1
codeload.github.com· found in install command
Files it touches
~/.claude/skills/redis-semantic-cache
What's inside
- Skill name
redis-semantic-cache- Description
- Redis LangCache guidance for semantic caching of LLM responses on Redis Cloud — calling search/set via the SDK or REST API, tuning the similarity threshold, separating caches per task type, and filtering with custom attributes. Use when caching LLM completions or RAG answers to cut API cost and latency, building a cache-aside layer in front of OpenAI / Anthropic / etc., tuning hit rate vs precision, or splitting one app's LLM workloads into multiple LangCache caches.
- License
- MIT
- Metadata
- author: Redis, Inc. · version: 0.1.0
- Instructions
- 81 lines in SKILL.md · view on GitHub
Files (3)
- SKILL.md
- best-practices.md · references/
- langcache-usage.md · references/
SKILL.md (first lines)
# 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:
1. Send the user's prompt to LangCache's `search`.
2. **Cache hit** — return the stored response directly.
3. **Cache miss** — call the LLM, then `set` the response so future similar prompts hit.
```python
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"),
)
result = lang_cache.search(prompt="What is Redis?", similarity_threshold=0.9)
if result:
response = result[0]["response"]
else:
response = llm.generate("What is Redis?")
lang_cache.set(prompt="What is Redis?", response=response)
```
The same operations are available via REST (`POST /v1/caches/{cacheId}/entries/search` and `POST /v1/caches/{cacheId}/entries`) when an SDK isn't an option.
See [references/langcache-usage.md](references/langcache-usage.md) for full SDK + REST samples and attribute-based storage.
## 2. Tune the similarity threshold
The threshold controls how close (in embedding cosine distance) a new prompt must be to a cached one to count as a hit. Higher = stricter match, fewer false positives. Lower = more hits, more risk of returning an off-topic answer.
| Threshold | Behavior | Use when |
|---|---|---|
| 0.95+ | Near-exact match required | Customer-facing answers where wrong responses are costly |
| 0.9 | Balanced default | Most workloads — start here |
| 0.8 | Loose semantic match | Internal tools, exploratory queries, FAQ deduplication |
```python
# Stricter — fewer false positives
result = lang_cache.search(prompt="What is Redis?", similarity_threshold=0.95)
# Looser — higher hit rate
result = lang_cache.search(prompt="What is Redis?", similarity_threshold=0.8)
```
Adjust by watching the actual cache-hit rate and spot-checking that returned answers are still relevant.
See [references/best-practices.md](references/best-practices.md).
## 3. Separate caches per task type
Different LLM workloads should not share one cache — a "code question" prompt is semantically close to other code questions but has nothing to do with a password-reset support query, and crossing them returns garbage.
```python
support_cache = LangCache(server_url=..., cache_id="support-cache-id", api_key=...)
code_cache = LangCache(server_url=..., cache_id="code-cache-id", api_key=...)
```
Create distinct cache IDs in Redis Cloud per task, and route each call to the right one. As a finer-grained alternative, store and search with **custom attributes** (e.g. `{"category": "database"}`) to keep tasks in the same cache but isolated by attribute filter — useful when the same prompt format spans subtopics.
## References
- [LangCache documentation](https://redis.io/docs/latest/develop/ai/langcache/)From redis/agent-skills, MIT.
More from redis/agent-skills
- 0.745score
iris-development
redisOfficial
Iris is Redis's umbrella for AI-focused products.
SkillBFreshness: B★ 169Claude Code +9 - 0.745score
redis-clustering
Redis, Inc.Official
Redis Cluster and replication guidance covering hash tags for multi-key operations, avoiding CROSSSLOT errors, and reading from replicas to scale read-heavy…
SkillBFreshness: B★ 169Claude Code +9 - 0.745score
redis-connections
Redis, Inc.Official
Redis client and connection guidance covering connection pooling, multiplexing, pipelining, client-side caching with RESP3, avoiding slow commands (KEYS…
SkillBFreshness: B★ 169Claude Code +9 - 0.745score
redis-core
Redis, Inc.Official
Core Redis modeling guidance — choose the right data structure (String, Hash, List, Set, Sorted Set, JSON, Stream, Vector Set) and use consistent…
SkillBFreshness: B★ 169Claude Code +9 - 0.745score
redis-observability
Redis, Inc.Official
Redis observability guidance — which metrics to monitor (memory, connections, hit ratio, ops/sec, rejected connections), which built-in commands to reach for…
SkillBFreshness: B★ 169Claude Code +9 - 0.745score
redis-search
Redis, Inc.Official
Redis Search guidance covering FT.CREATE schema design, field type selection (TEXT, TAG, NUMERIC, GEO, GEOSHAPE, VECTOR, JSON path), DIALECT 2 query syntax…
SkillBFreshness: B★ 169Claude Code +9 - 0.745score
redis-security
Redis, Inc.Official
Redis security guidance covering authentication (requirepass and ACL users), TLS, ACL-based least-privilege access control, restricting network exposure via…
SkillBFreshness: B★ 169Claude Code +9
Signals
- Stars
- 169
- Forks
- 31
- Open issues
- 5
- Last commit (this folder)
- Aug 11, 2026 (2 months ago)
From GitHub (fetched Oct 24, 2026).
Details
- Version
- 0.1.0
- License
- MIT
- Repository
- github.com/redis/agent-skills
- Website
- redis.io
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
Same skill elsewhere
Copies of this SKILL.md published by others; search shows only one of them.
More from Redis, Inc.
- 0.745score
redis-clustering
Redis, Inc.Official
Redis Cluster and replication guidance covering hash tags for multi-key operations, avoiding CROSSSLOT errors, and reading from replicas to scale read-heavy…
SkillBFreshness: B★ 169Claude Code +9 - 0.745score
redis-connections
Redis, Inc.Official
Redis client and connection guidance covering connection pooling, multiplexing, pipelining, client-side caching with RESP3, avoiding slow commands (KEYS…
SkillBFreshness: B★ 169Claude Code +9 - 0.745score
redis-core
Redis, Inc.Official
Core Redis modeling guidance — choose the right data structure (String, Hash, List, Set, Sorted Set, JSON, Stream, Vector Set) and use consistent…
SkillBFreshness: B★ 169Claude Code +9 - 0.745score
redis-observability
Redis, Inc.Official
Redis observability guidance — which metrics to monitor (memory, connections, hit ratio, ops/sec, rejected connections), which built-in commands to reach for…
SkillBFreshness: B★ 169Claude Code +9 - 0.745score
redis-search
Redis, Inc.Official
Redis Search guidance covering FT.CREATE schema design, field type selection (TEXT, TAG, NUMERIC, GEO, GEOSHAPE, VECTOR, JSON path), DIALECT 2 query syntax…
SkillBFreshness: B★ 169Claude Code +9 - 0.745score
redis-security
Redis, Inc.Official
Redis security guidance covering authentication (requirepass and ACL users), TLS, ACL-based least-privilege access control, restricting network exposure via…
SkillBFreshness: B★ 169Claude Code +9
Cite this page
redis-semantic-cache skill. Agent Mart. https://agentmart.dev/skills/redis-redis-semantic-cache (last updated 2026-10-24)