Cache control does not change

Builder content link

Builder public api key
1d8ecee591ac4358befb8fe998100548

What are you trying to accomplish

  • I followed this doc and added “cacheSeconds” and “staleCacheSeconds” as the doc recommend, but when previewing the page in our local environment, the cache control does not reflect.
export const getPageModelData = async (slug: string) => {
  const pageData = await builder
    .get('page', {
      userAttributes: {
        urlPath: slug,
      },
      cacheSeconds: 3600,
      staleCacheSeconds: 86400,
      prerender: false,
      options: {
        enrich: true,
      },
    })
    .toPromise();

  return pageData;
};

Code stack you are integrating Builder with
“next”: “14.1.3”, “@builder.io/react”: "~3.1.2

Hi @tlee-pb - I should clarify that our settings only update the API request cache headers, your site’s response headers are controlled by next.js.
Sorry for the confusion.

Hello @Stephane, do you have an example in the Builder’s GitHub for NextJs on the both (NextJs and Builder.io) cache setup. I am interested to know what would be the recommended pattern for setting up cache with Builder and Next 14.

Thank you so much for the help. :pray:

Hi @tlee-pb -

Next.js framework is outside of our scope of what Builder would provide direct support or documentation.

However, here is the Next documentation on caching:

Hope this helps.

1 Like

Thank you so much for the assist~

1 Like