Caching
Vercel CDN caching, ISR, revalidation, and cache invalidation strategies
Caching
Caching configuration for Jose Madrid Salsa across the Vercel platform, Next.js, and application-level caches.
Vercel CDN Cache
Vercel automatically caches static assets and pages at the edge. The cache behavior depends on the response headers and route type.
Static Pages
Pages without dynamic data are pre-rendered at build time and served from the CDN indefinitely until the next deployment.
Dynamic Pages
Pages with revalidate configured use Incremental Static Regeneration (ISR):
// Example from various API routes and pages
export const revalidate = 3600 // Revalidate every hourThe project uses revalidate in multiple API routes and pages for data that changes infrequently (locations, forms, reviews).
Build Cache Invalidation
Each build generates a unique build ID to force cache invalidation:
generateBuildId: async () => {
return `build-${Date.now()}`
}This ensures that every deployment serves fresh content rather than stale cached pages from a previous build.
Image Caching
Next.js Image Optimization
Optimized images are cached with a minimum TTL:
images: {
minimumCacheTTL: 60, // 60 seconds minimum
}Image Proxy
/api/image-proxy no longer proxies Google Places photos. It returns a 308 redirect to the placeholder image with Cache-Control: public, max-age=31536000, immutable, so pages cached with old proxy URLs still show an image without any call to Google.
Prisma Accelerate Cache
When Prisma Accelerate is enabled (via prisma:// connection string), it provides query-level edge caching:
- Connection pooling -- Reduces cold start latency
- Query caching -- Frequently executed queries are cached at the edge
- Global distribution -- Cache nodes close to users worldwide
Revalidation Patterns
The project uses two revalidation approaches:
Time-Based Revalidation
// Page or route segment config
export const revalidate = 3600 // 1 hourUsed for:
- Location listings
- Product catalogs
- Google reviews
- Form definitions
On-Demand Revalidation
Server Actions and admin operations trigger revalidation when data changes:
import { revalidatePath, revalidateTag } from 'next/cache'
// After updating a product
revalidatePath('/products')
// After updating locations
revalidatePath('/find-us')Cache Debugging
Force Cache Bypass
During development:
# Bypass cache with hard refresh
Cmd+Shift+R (Mac) / Ctrl+Shift+R (Windows)Verify Cache Status
Check the x-vercel-cache response header:
| Value | Meaning |
|---|---|
HIT | Served from CDN cache |
MISS | Not in cache, fetched from origin |
STALE | Served stale while revalidating |
PRERENDER | Pre-rendered at build time |
curl -I https://www.josemadridsalsa.com/products | grep x-vercel-cacheCache Strategy Summary
| Content Type | Cache Location | TTL | Invalidation |
|---|---|---|---|
| Static pages | Vercel CDN | Until redeployment | New build |
| ISR pages | Vercel CDN | revalidate seconds | Time-based or on-demand |
| Optimized images | Vercel CDN | 60s minimum | Automatic |
| Proxied Google images | CDN + browser | 24 hours | TTL expiry |
| Prisma queries | Accelerate edge | Configurable | Query-specific |
| In-memory (photo URLs) | Function instance | 24 hours | Cold start |
How is this guide?
Last updated on
BigCommerce Cutover Runbook
Step-by-step plan for putting this site on josemadridsalsa.com in front of BigCommerce, with the soft launch, domain move, webhook updates and rollback
CI Artifact Storage
Retention windows for GitHub Actions artifacts, and how to run the Artifact Cleanup workflow when the storage quota fills