Back to Prompts
Coding Assistant

Add Basic Caching

Start here. The simplest caching pattern. From the Caching AI Coding Building Block.

Prompt
Add caching to my [web app / API / mobile backend]. Right now, every request hits the database directly, even for data that rarely changes.

I need:
- Cache frequently accessed data like [user profiles / product listings / search results]
- Set a TTL of [1 hour] so the cache stays fresh
- Invalidate the cache when the underlying data is updated
- Log cache hits vs misses so I can measure the impact
- Use [Redis / in-memory / file-based] caching

My stack: [your framework and language here]

I'm learning, so explain each part simply.
4 views 0 copies