Next.js Server-Side Cache Testing

Custom Cache Handler Stats

Click "Refresh Stats" to view custom cache handler statistics

Test different Next.js API caching strategies with real server-side cache behavior

Client-side testing: Call API endpoints to see server cache behavior

API Cache Test Controls

No Cache

Always fetches fresh data

Force Cache

Uses cache indefinitely

Revalidate 60s

Cache for 60 seconds

Tagged Cache

Cache with tags (5 min)

API Cache Results

Next.js API Route Cache Strategies

cache: 'no-store'

Always fetches fresh data from external API. No server-side caching. Highest latency but always current.

cache: 'force-cache'

Caches indefinitely until manually invalidated. Fastest response after first fetch.

next: {revalidate: 60}

Cached for specified seconds, background revalidation. Good balance of performance and freshness.

Tagged Cache

Time-based caching with on-demand invalidation using cache tags. Click on tags above to trigger revalidation.

🧪 Testing Tips:

  • • Watch server response times - cached responses should be much faster
  • • Compare "Client" vs "Server" timings in results
  • • Test multiple times to see cache hits vs misses
  • • Use browser DevTools Network tab to observe actual requests
  • • Click cache tags to test on-demand revalidation