Caching Strategies
In this article
- Name the four places an agent can keep a result for reuse, and say in which one the provider does the matching.
- Write a cache key, a lifetime and a clearing rule for a stored result, and reject entries that are unsafe to store.
- Compute what a cache saves per hour and the hit rate below which it loses money.
- Terms defined here: cache key, break-even hit rate.
Overview
A support assistant answers the same handful of questions all day. Each time it searches the help pages, calls a model and waits. Keeping the last answer and handing it out again looks like free speed. It is, until a stored result reaches the wrong person: one customer asks about an order and sees somebody else's.
Brightline, an invented home-internet provider, runs a support assistant on its website that answers customers and can look up an order, issue a refund of at most $50 and hand a conversation to a person on the support team. The team has five candidates to cache: (1) the prompt opening, (2) the search_help result for "refund policy", (3) the lookup_order result, (4) the final answer to "How do I restart my router?" and (5) the final answer to "What is my balance?".
By the end you can say where a result can be kept, what its key must hold, how long it may live, what clears it, and whether the cache pays.
Sign in to keep reading
The rest of this article opens with an account. An account also keeps your progress and quiz results on every device, and lets you follow news for up to five topics.
Still to read in this article
- Four places to keep a result
- What goes in the key
- How long an entry lives
- Five candidates, decided
- Does it pay
- Common mistakes
- In production
- Sources
- Check yourself, 13 questions