Skip to content
Discussion options

You must be logged in to vote

Hi there! The helpers use Next.js's default cache profile: getSitecorePage has 'use cache' and cacheTag, but no cacheLife call.

The 15 minutes is the revalidation interval, rather than a hard expiration, a subsequent request can serve the cached result while a background refresh runs. Tag-based invalidation can happen sooner.

Calling cacheLife explicitly would make the policy clearer, as the Next.js docs recommend. For example, to use the hours profile:

import { cacheLife, cacheTag } from 'next/cache';

export async function getSitecorePage(params: GetSitecorePageParams) {
  'use cache';
  cacheLife('hours');

  // existing fetch and cacheTag calls
}

Choose the profile that fits your publ…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@mjarosch
Comment options

@mjarosch
Comment options

Answer selected by mjarosch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
2 participants