r/nextjs • • Oct 24 '26

Next.js 16 cacheComponents & use cache vs. custom caching (Redis) with Payload CMS? How are you handling large sites in production?

Hey everyone,
I
I’m about to start a new project pairing Next.js with Payload CMS using its Local API (querying the database directly via Node on the server), and I’m weighing my options.
I’m curious how others are tackling this in production, especially for sites with a large number of pages:
The Native Approach: Are you diving into Next.js 16's cacheComponents with 'use cache' and cacheLife / cacheTag? If you are deploying outside of Vercel, how smooth is configuring cacheHandlers (plural) for a custom backend like Redis?

The Remote Directive: For multi-instance or serverless environments, are people actually using 'use cache: remote' in production, or do you find yourselves falling back to manual caching layers?

Bypassing Framework Caching: Do you completely disable Next's default caching behaviors for dynamic content and handle caching granularity yourself (e.g., wrapping Payload Local API calls explicitly with Redis/Memcached)?

Payload + Local API Specifics: Since Payload's Local API bypasses network overhead and talks straight to the database, wrapping those calls or components with 'use cache' seems powerful, but invalidation via revalidateTag needs to line up cleanly with Payload's hooks (e.g., afterChange). Has anyone hit weird edge cases with this combo at scale?

What has worked best for you when managing hundreds or thousands of pages where you need aggressive caching alongside instant editorial updates? Would love to hear what your current production setup looks like.

29 Upvotes

30 comments sorted by

View all comments

2

u/SameLink_io Oct 26 '26

Adding the single box view since most answers here are Vercel or Kubernetes.

If you run one Next.js instance on a VPS, the default file system cache works fine and revalidateTag from Payload's afterChange hook just works, because there's only one process to invalidate. That covers a lot more sites than people expect, thousands of pages included. Things only get interesting the moment you run two instances (zero downtime deploys, or more than one container behind Caddy/nginx), because each one has its own cache and invalidation only reaches the one that got the request.

What I'd do for that case:

  • Point both cacheHandler (ISR and fetch cache) and the cacheHandlers used by 'use cache' at a shared Redis on the same box. A Redis with maxmemory 256mb and allkeys-lru is plenty for most content sites.
  • Keep tags boring and consistent: collection:posts and posts:<id>, set with cacheTag where you call the Local API, and the same strings revalidated in afterChange and afterDelete. Remember relations: if a post shows its author, revalidate the author tag too, otherwise that's where stale content hides.
  • Set a long cacheLife on the editorial pages and rely on tags for freshness, rather than short revalidate windows that hammer the DB.

Also worth knowing: during a blue/green deploy the new build has a different build ID, so with a shared cache you want the build ID in the key prefix, or you'll briefly serve pages rendered by the old build. I'd skip 'use cache: remote' unless you're actually serverless; on your own server the handler approach is simpler to reason about.