redis-semantic-cache

Implements semantic caching of LLM responses using Redis LangCache search and set operations.

Updated Jul 25, 2026
One-click install
npx skills add https://github.com/kaannakiin/turborepo_template --skill redis-semantic-cache-kaannakiin
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: redis-semantic-cache
Source: https://github.com/kaannakiin/turborepo_template/tree/main/.agents/skills/redis-semantic-cache
Command: npx skills add https://github.com/kaannakiin/turborepo_template --skill redis-semantic-cache-kaannakiin

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires langcache, and includes references (resource) components.

What problem does it solve? Repeated LLM API calls for semantically similar prompts waste money and add latency. This Skill guides you through adding a cache-aside layer in front of OpenAI, Anthropic, or other LLM providers using Redis Cloud's LangCache service, so similar prompts return cached responses without re-calling the model. ## Core Features & Use Cases - Cache-Aside Flow: Search LangCache before calling the LLM, and store responses on cache misses via the Python SDK or REST API. - Similarity Threshold Tuning: Adjust the cosine similarity threshold (0.8 to 0.95+) to balance hit rate against false-positive risk. - Per-Task Cache Separation: Route different LLM workloads to distinct cache IDs, or filter within one cache using custom attributes. - Use Case: A support chatbot receives thousands of paraphrased versions of the same questions. Wrap the LLM call with LangCache so repeat questions return instantly from cache, cutting API spend and response time. ## Quick Start Wrap my OpenAI call with Redis LangCache so semantically similar prompts return cached responses using a 0.9 similarity threshold.

Frequently Asked Questions about redis-semantic-cache

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I cache LLM responses with Redis LangCache?

Use the LangCache Python SDK to call search with the prompt before invoking the LLM. On a cache hit, return the stored response; on a miss, call the LLM and store the result with set so future similar prompts hit the cache.

What similarity threshold should I use for semantic caching?

Start with 0.9 as a balanced default for most workloads. Use 0.95 or higher for customer-facing answers where wrong responses are costly, and 0.8 for internal tools or FAQ deduplication where a higher hit rate matters more.

Can I use LangCache without the Python SDK?

Yes, LangCache exposes a REST API with POST /v1/caches/{cacheId}/entries/search for lookups and POST /v1/caches/{cacheId}/entries for storing responses. Authenticate with a Bearer API key and pass the prompt as JSON.

Should different LLM tasks share one semantic cache?

No, different workloads should use separate cache IDs because semantically close prompts across unrelated tasks can return irrelevant responses. Alternatively, store and search with custom attributes like category to isolate subtopics within one cache.

Is LangCache generally available on Redis Cloud?

LangCache is currently in preview on Redis Cloud, so features and behavior may change. Check the official Redis LangCache documentation for the latest availability status before production use.