- Docker container is running old code without
cachedFetch() - Many APIs show cache misses on every request
- Next.js Data Cache is not being used
The code has been updated but the container needs to be rebuilt:
# Stop and remove old container
docker-compose down
# Rebuild with new code
docker-compose build --no-cache
# Start container
docker-compose up -d
# Check logs
docker-compose logs -f nextjs-cache- ✅ All API calls now use
cachedFetch(url, revalidate) - ✅ Added cache directory permissions in Dockerfile
- ✅ Added volume mount for persistent cache
- ⏳ Needs rebuild to apply changes
First Request:
- All APIs: Cache MISS
- Load time: ~400-900ms per API
Second Request (within TTL):
- All APIs: Cache HIT
- Load time: ~0-5ms
Check logs for these patterns:
✅ Good: Cache HIT for jsonplaceholder-posts: 0ms
❌ Bad: Cache MISS for jsonplaceholder-posts
npm run dev
# Visit http://localhost:3000/active-cachedocker-compose up -d
# Visit http://localhost:3003/active-cache- Phase 1 (
/inactive-cache): Direct API calls, no caching - Phase 2 (
/active-cache): Next.js 16 fetch cache with revalidation - Phase 3 (
/full-route-cache): Full Route Cache with ISR (Static Generation) - Comparison (
/comparison): Side-by-side performance comparison of all 3 phases
Uses Next.js Data Cache with fetch(url, { next: { revalidate: seconds } }):
- Persists across requests in
.next/cachefolder - Works in standalone Docker deployment
- Automatic revalidation based on TTL