P
💻DeveloppementAdvancedClaude

Design an Application Caching Strategy

Design a complete Redis caching strategy with appropriate patterns, TTL policy, invalidation, and stampede protection.

Paste in your AI

Paste this prompt in ChatGPT, Claude or Gemini and customize the variables in brackets.

Tu es un architecte systèmes expert en stratégies de mise en cache et en optimisation des performances applicatives. Je dois mettre en place une stratégie de cache robuste pour mon application.

Contexte de l'application :

  • Type : [EX: API REST à fort trafic, application web B2C, plateforme de données]
  • Stack : [EX: Node.js + PostgreSQL, Python + MongoDB]
  • Solution de cache envisagée : [EX: Redis 7, Memcached, cache en mémoire]
  • Trafic actuel : [EX: 1000 requêtes/minute, pics à 5000]
  • Problème de performance : [EX: requêtes DB trop lentes, API tierce rate-limited, calculs coûteux]

Données candidates au cache :
[LISTER_LES_TYPES_DE_DONNÉES: ex. profils utilisateurs, résultats de recherche, configurations, sessions, tokens JWT révoqués]

Conçois une stratégie de cache complète :

  1. Analyse des données : classe chaque type de donnée par fréquence d'accès, taux de modification et coût de recalcul pour prioriser ce qui mérite d'être caché.
  2. Patterns de cache : recommande et implémente les patterns appropriés (Cache-Aside, Write-Through, Write-Behind, Read-Through) pour chaque cas d'usage.
  3. Politique d'expiration (TTL) : définis des TTL appropriés pour chaque type de donnée avec justification.
  4. Stratégie d'invalidation : comment invalider le cache lors des mises à jour des données (invalidation par clé, pattern, event-driven).
  5. Gestion des ratés de cache (Cache Miss) : protection contre le Cache Stampede (thundering herd) et le Cache Penetration.
  6. Cache distribué : considérations pour un environnement multi-instances (Redis Cluster, serialisation).
  7. Métriques : métriques à surveiller (hit rate, miss rate, memory usage, évictions) et seuils d'alerte.

Personalize this prompt with Léa

Léa rewrites this prompt for your job and your exact goal — 3 quick questions.

Why this prompt works

<p>This prompt is structured to approach caching as a complete systems engineering problem. The initial analysis by access frequency and recomputation cost is the most important step: caching the wrong data (data that changes constantly or is rarely accessed) is worse than not caching at all because it adds complexity without benefit.</p><p>Protection against Cache Stampede (thundering herd) is often ignored until the first production incident: when a cache expires, all simultaneous requests hit the database at once, causing exactly the overload you were trying to avoid. This prompt forces anticipation of this scenario.</p><p>Requesting specific metrics with alert thresholds transforms the design into an observable system: a hit rate below 80% generally indicates a bad TTL policy or overly aggressive invalidation, metrics that allow continuous cache tuning in production.</p>

Use Cases

Performance optimization through cachingHigh-traffic system architectureReducing database costs

Expected Output

A complete caching strategy with data analysis, recommended patterns, TTL policy, invalidation strategy, and monitoring metrics.

Improve this prompt

Run this prompt through the Optimizer to strengthen its context, constraints and expected format.

Improve this prompt with the Optimizer

Comments

  • LéaAI

    Ajoute une section "Analyse des coûts de cache vs recalcul" pour justifier le TTL de chaque donnée en fonction de son volume et de son taux d'obsolescence acceptable. Cela évite de cacher des données rarement lues qui consomment inutilement de la mémoire.

📬 Get new prompts every week

Join our newsletter and never miss a prompt.

Go further

Similar Prompts

💻DeveloppementIntermediateAll AIs

Perplexity Prompt for Creating a Software Architecture

Perplexity stands out as a particularly powerful tool for software architecture design thanks to its ability to synthesize recent and verified technical sources. Unlike a classic LLM that relies solely on its training data, Perplexity queries the web in real time to integrate the latest best practices, emerging architectural patterns, and community feedback. Whether you are designing a microservices architecture, a modular monolith, or an event-driven system, a well-structured prompt allows you to obtain contextualized recommendations with verifiable sources. The challenge is to provide enough business and technical context for Perplexity to cross-reference relevant information: technology stack, scalability constraints, infrastructure budget, and team skills. By phrasing your request precisely, you transform Perplexity into a true consultant architect capable of proposing component diagrams, reasoned technology choices, and deployment strategies tailored to your specific context.

473
💻DeveloppementIntermediateClaude

Write a project's CLAUDE.md: the brief Claude Code reads at every session

Turns your project description into a dense CLAUDE.md: commands, structure, conventions, pitfalls, off-limits areas and situations where the agent must ask before acting.

282
💻DeveloppementAdvancedAll AIs

Kubernetes Backup Strategy

Kubernetes Disaster Recovery Plan

320
💻DeveloppementIntermediateAll AIs

Adapting an API for Different Clients

Tailoring API responses to client needs

368
Redis Cache Strategy Prompt - Performance Architecture | Prompt Guide