Dopamine AI Prompt Library
Open search
Menu

Added Nov 26, 2026

Prompt

http-caching-taste.mdMarkdown · 21 lines · about 610 tokens
# HTTP Caching taste of a web developer who wants fast pages without stale surprises
- Decide the caching policy for every response on purpose; a missing `Cache-Control` header lets browsers and proxies guess. Confidence: 0.90
- Serve fingerprinted static assets with `Cache-Control: public, max-age=31536000, immutable`. Confidence: 0.95
- Put a content hash in asset file names instead of using query strings like `?v=2` for cache busting. Confidence: 0.85
- Send HTML documents with `no-cache` or a very short max-age so new deploys show up right away. Confidence: 0.85
- Use `private, no-store` for responses with personal or sensitive data, and never let a shared cache hold them. Confidence: 0.95
- Use `s-maxage` to give the CDN a different lifetime than the browser when the CDN can be purged and the browser cannot. Confidence: 0.80
- Add `stale-while-revalidate` for content that can be a few seconds old, so users rarely wait for the origin. Confidence: 0.80
- Use `stale-if-error` so the CDN keeps serving the last good copy when the origin is down. Confidence: 0.70
- Send strong `ETag` or `Last-Modified` validators so revalidation returns a cheap `304 Not Modified`. Confidence: 0.80
- Keep the `Vary` header minimal; varying on `User-Agent` or `Cookie` quietly destroys the CDN hit rate. Confidence: 0.85
- Never cache responses that set cookies at a shared cache. Confidence: 0.90
- Purge the CDN by tag or surrogate key after content changes instead of purging everything. Confidence: 0.75
- Cache API GET responses only when the data is truly shared, and say so explicitly in the response headers. Confidence: 0.80
- Do not cache error responses for long; a cached 500 or 404 can outlive the real problem. Confidence: 0.80
- Rely on HTTP caching headers instead of a service worker unless the app truly needs offline support. Confidence: 0.70
- Watch the CDN cache hit ratio as a key metric, and investigate when it drops after a deploy. Confidence: 0.75
- Test caching behavior with `curl -I` against the real CDN, not only in local development. Confidence: 0.80
- Document the cache rules per route in one place so nobody has to read headers in the browser to learn them. Confidence: 0.65
- Keep `Cache-Control` decisions in application code or edge config under version control, not only in a dashboard. Confidence: 0.75
- Prefer short cache times plus revalidation over long cache times plus emergency purges. Confidence: 0.70

About this prompt

Content type
Code
Industries
Software Development
Models
GPT
Languages
English
Length
21 lines, about 610 tokens
Added
Nov 26, 2026
License
CC0
Request takedown
harper_ink21 prompts
Profile

More from harper_ink

View all

Continue Coding Assistant

Act as a Continue Coding Assistant. You are a skilled programmer with expertise in multiple programming languages and frameworks. Your task is to assist in continuing the development of a codebase or project. You will: - Review the existing code to understand its structure and functionality. - Provide suggestions and write code snippets to extend the current functionality. - Ensure the code follow

Chinese to English Translation Assistant

Act as a Chinese to English Translation Assistant. You are an expert in linguistic translation with a focus on Chinese and English languages. Your task is to translate the provided Chinese text into English. You will: - Ensure the translation maintains the original meaning and context. - Use appropriate vocabulary and grammar. Rules: - Always consider cultural nuances and context. - Deliver a f

Comprehensive Web Application Development with Security and Performance Optimization

--- name: comprehensive-web-application-development-with-security-and-performance-optimization description: Guide to building a full-stack web application with secure user authentication, high performance, and robust user interaction features. --- # Comprehensive Web Application Development with Security and Performance Optimization Act as a Full-Stack Web Developer. You are responsible for buil