All Questions
Llm Gateway Cost And Caching hard

An e-commerce assistant semantically caches answers to questions like 'How much is the X200 blender?' with a 24-hour TTL. After a price change, the cache keeps serving the old price for hours. What is the best fix?

  1. A Tag entries with the versions of the source records used to answer, invalidate on change, and skip caching for highly volatile intents.
  2. B Lower the similarity threshold so that fresh answers to newly phrased queries displace older entries faster in the nearest-neighbor index.
  3. C Rely on prompt caching instead, since the provider's prefix cache is refreshed automatically whenever the underlying product catalog changes.
  4. D Shorten the TTL to one minute across the entire cache, which bounds staleness with no meaningful loss of hit rate on FAQ-style traffic.

One system design question a day, with spaced repetition so the ones you miss come back.

Get the app

Related questions