Any
⚙️ Technical
Advanced
Implement a Caching Strategy
Design and implement the right caching approach for any application performance problem.
The Prompt
Design and implement a caching strategy for the following application: Application type: [web app / API / mobile backend / data pipeline] Current performance problem: [describe what is slow and the scale of the issue] Stack: [language, framework, database, current infrastructure] Data characteristics: [how often data changes / read vs write ratio / data size] Consistency requirements: [strict consistency required / eventual consistency acceptable] Available caching infrastructure: [Redis / Memcached / CDN / in-memory / none yet] Traffic patterns: [consistent / spiky / read-heavy / write-heavy] Provide a complete caching strategy: CACHING LAYER DESIGN: - Which caching layers to implement (browser / CDN / application / database) - Cache topology recommendation (single node / cluster / distributed) - Cache sizing and memory allocation CACHING PATTERNS: For each data type in the application, recommend: - Cache-aside vs read-through vs write-through vs write-behind - TTL (time to live) values with justification - Cache key naming convention - Cache warming strategy CACHE INVALIDATION: - Invalidation strategy per data type (TTL / event-driven / manual) - Handling stale data gracefully - Cache stampede prevention (thundering herd problem) - Tag-based invalidation where appropriate IMPLEMENTATION CODE: - Cache client setup and connection pooling - Generic cache wrapper/decorator - Cache-aside pattern implementation - Cache invalidation helpers - Specific implementations for the top 3 slowest operations DATABASE QUERY CACHING: - Query result caching approach - ORM-level caching configuration - Read replica routing CDN CONFIGURATION: - Static asset caching rules - Dynamic content caching rules - Cache-Control header strategy MONITORING: - Cache hit rate targets - Memory usage monitoring - Eviction rate alerting - Key metrics dashboard FAILURE HANDLING: - Behaviour when cache is unavailable - Circuit breaker for cache layer - Graceful degradation approach
📝 Fill in the blanks
Replace these placeholders with your own content:
[web app / API / mobile backend / data pipeline]
[describe what is slow and the scale of the issue]
[language, framework, database, current infrastructure]
[how often data changes / read vs write ratio / data size]
[strict consistency required / eventual consistency acceptable]
[Redis / Memcached / CDN / in-memory / none yet]
[consistent / spiky / read-heavy / write-heavy]
How to use this prompt
1
Copy the prompt
Click "Copy Prompt" above to copy the full prompt text to your clipboard.
2
Replace the placeholders
Swap out anything in [BRACKETS] with your specific details.
3
Paste into Any
Open your preferred AI assistant and paste the prompt to get started.