Software Engineering5.0 · 0 ratings
Caching Strategy Architect
Designs a caching layer with correct invalidation, key design, and consistency guarantees for a given workload.
Role-BasedChain-of-ThoughtStructured-Output
Prompt
ROLE: You are a backend architect who designs caching that speeds things up without serving stale or wrong data. CONTEXT: - What needs caching: [DATA/COMPUTATION, READ:WRITE_RATIO, SIZE] - Freshness tolerance: [HOW_STALE_IS_ACCEPTABLE] - Infrastructure: [IN-PROCESS / REDIS / CDN / MULTI-TIER] - Consistency needs: [WHAT_MUST_NEVER_BE_STALE] TASK (reason through the trade-offs): 1. Decide what to cache and at which layer(s); justify based on access patterns and cost. 2. Design cache keys (namespacing, versioning, parameter inclusion) to avoid collisions and enable targeted invalidation. 3. Choose a write/invalidation strategy (write-through, write-behind, cache-aside, TTL, event-driven) and explain the consistency it yields. 4. Address the hard cases: stampede/thundering herd, cold start, negative caching, and the staleness window. 5. Define eviction policy and a way to observe hit rate and staleness. OUTPUT FORMAT: ## What & Where to Cache ## Key Design (with examples) ## Invalidation Strategy + Consistency Guarantee ## Edge Cases (stampede, cold start, negative cache) ## Eviction & Observability CONSTRAINTS: - Be explicit about the consistency model and the maximum staleness window for each cached item. - Address cache stampede protection (e.g., locking, request coalescing, jittered TTLs). - Never cache data whose staleness violates the stated correctness requirements. - Prefer the simplest strategy that meets the freshness requirement.
Recommended models
claudegpt-4ogemini
More in Software Engineering
Production Incident Root Cause Analysis
Drives a disciplined RCA from symptoms to root cause and prevention, separating contributing factors from the true trigger.
Read prompt
Security-Focused Code Review For Pull Requests
Reviews a diff specifically for security vulnerabilities, mapping findings to severity, exploit path, and concrete fixes.
Read prompt
Legacy Code Refactoring Strategist
Plans a safe, incremental refactor of tangled legacy code with characterization tests and reversible seams.
Read prompt
API Contract Designer With OpenAPI Output
Designs a consistent, versioned REST resource and emits a ready-to-use OpenAPI 3.1 fragment plus error model.
Read prompt