Next.js Discord

Discord Forum

Cache SSR pages for 24h

Unanswered
Channel catfish posted this in #help-forum
Open in Discord
Channel catfishOP
Hi team, we are trying to cache our SSR pages for 24h but it is not working, the page get cache for sometime less than 24h and then revalidate happen

12 Replies

Channel catfishOP
here is our config
export const getServerSideProps: GetServerSideProps = async ({ params, locale, req, res, previewData, }): Promise<IBrandServerSidePropsResp> => { res.setHeader( 'Vercel-CDN-Cache-Control', 'public, max-age=86400, stale-while-revalidate=87300', ); // set caching header
we are expecting the page to be cache 24h and after that be revalidate, but it is not
we found this on the doc
While you can put the maximum time for server-side caching, cache times are best-effort and not guaranteed. If an asset is requested often, it is more likely to live the entire duration. If your asset is rarely requested (e.g. once a day), it may be evicted from the regional cache.
so we are not sure if we are understanding this correctly
Channel catfishOP
our project shows that there is not data cached
Channel catfishOP
@Giant panda Do you have any thoughts?
Giant panda
Please do not ping moderators for technical support or random people for that matter according to our rule number 5.
Channel catfishOP
sorry
Channel catfishOP
After we hit the limit, the cache get clean up?