Q31 Redis Domain 2 · 25–30% of exam Priority · Real Exam

Semantic caching for an LLM must return a cached answer for paraphrased prompts. What is the core mechanism?

  1. A Hash the prompt string and use GET
  2. B Embed the prompt, KNN search cached embeddings, and return the hit if distance is below a threshold (correct answer)
  3. C Store prompts in a Redis List and scan
  4. D Use SETEX with a short TTL

Shortcut: Exact-match hashing misses paraphrases. Semantic caching embeds the prompt, finds the nearest cached vector, and reuses the stored response when similarity exceeds the configured threshold.