Plan caching for a slow endpoint
Prompt that plans caching for a slow endpoint: what may be cached, where the cache sits and how stale entries are removed. Paste it into an AI tool of your choice, which then plans caching.
- Topic
- Apps & prototypes
- Type
- Prompt
- Level
- Intermediate
- Time
- about 8 min
Results depend on the tool, the model and what you enter.
Result preview
Example: written by our editors, not real AI output.
Root cause first: the query has no index on "category"; that alone will probably save a lot of time. Cache: application, key product_list:{category}:{filter}:{page}, valid for 5 minutes Never cached: prices with customer discounts, basket Invalidation: when a product is saved, delete all keys for its category Concurrent requests: only one recomputes, the others briefly get the old entry Measure: hit rate, response time at peak times Assumption: stock levels may be up to 5 minutes old.
Fill in
What you type stays in this browser window. We store and send nothing.
- product list with filters in a shop
- home screen of a news app
- dashboard with metrics per account
- postcode lookup
- price calculation for quotes
- several times a minute
- a few times a day
- only during the nightly import
- differs per account
- almost never
- response time over two seconds at peak times
- database is fully loaded on every call
- expensive call to an external service
- every call recalculates everything
- queries run into timeouts
Your prompt
You have edited the prompt. Changes in the fields above no longer overwrite it.
This is an instruction for an AI, not the result itself.
Where this prompt works
These AI tools are a good fit for this prompt:
How to use it
- Fill in the fields or tap a suggestion. Leave out names, addresses and other personal data.
- Copy the finished prompt into an AI tool of your choice.
- Introduce caching for a single endpoint first, measure hit rate and response time for a week and only then extend it.
Why does this work?
The question of what must never be cached comes before the technology, so that nobody receives another user's data. A clear way to remove entries prevents a cache that is faster but wrong.
Tips
- Even a cache of a few seconds often absorbs load peaks well and keeps the risk of stale data small.