import Link from 'next/link'; // Separate the client component into its own file import { RevalidationInterface } from './revalidation-interface'; export default function HomePage() { return (

Next.js Redis Cache Testing

This is a test application for the nextjs-turbo-redis-cache package, demonstrating various caching strategies.

Pages

{/* Cached Static Fetch Pages */}

Cached Static Fetch

API Route: /api/cached-static-fetch
These pages fetch data from the cached static API route with{' '} force-static and revalidate: false{' '} settings.
  • Default + Force Dynamic
  • Revalidate 15s + Default
  • Revalidate 15s + Force Dynamic
{/* No Fetch Pages */}

No Fetch

API Route: None
These pages don't make any API requests and are statically generated without external data.
  • Default Page
{/* Revalidated Fetch Pages */}

Revalidated Fetch

API Route: /api/revalidated-fetch
These pages fetch data from the revalidated API route with{' '} revalidate: 5 setting, causing automatic revalidation after 5 seconds.
  • Default + Force Dynamic
  • Revalidate 15s + Default
  • Revalidate 15s + Force Dynamic
{/* Uncached Fetch Pages */}

Uncached Fetch

API Route: /api/uncached-fetch
These pages fetch data from the uncached API route with{' '} dynamic: 'force-dynamic' setting, causing a new fetch on every request.
  • Default + Force Dynamic
  • Revalidate 15s + Default
  • Revalidate 15s + Force Dynamic

API Routes

{/* API Routes */}

Cache Control APIs

These API routes demonstrate different caching behaviors. Each returns a counter value that increases on each uncached request.
  • Cached Static Fetch
  • Uncached Fetch
  • Revalidated Fetch
  • Nested Fetch in API Route

Revalidation APIs

These API routes allow on-demand revalidation of cached content using either path-based or tag-based approaches.
  • Revalidate Path
  • Revalidate Tag

Revalidation Interface

Cache Testing Tools

Use these links to test various caching scenarios. Each link demonstrates different caching behaviors:

  • Cached Static Fetch: Demonstrates static caching with no revalidation
  • Revalidated Fetch: Shows how data is revalidated after a specified time
  • Uncached Fetch: Shows dynamic data fetching without caching
  • Revalidate Path/Tag: Demonstrates on-demand revalidation

Testing Tip: Try visiting a page, then triggering revalidation using the API routes, and observe how the counter values change.

); }