Suggestions for response caching

working on my first datoā€¦ and first react project.

how do folks typically handle response caching. Iā€™m working with next.js (SSR).

just looking for some suggestions on best practices so that i can start to figure this out.

if you use getStaticProp ( https://nextjs.org/docs/basic-features/data-fetching#when-should-i-use-getstaticprops ) it will fetch the content only at build time effectively hitting our API only then. Then you can trigger a new build to invalidate the cache and generate a new build. What are you doing?

Using getServerSideProps. We have some components on all the pages that change daily and we will have authors contributing content throughout the day. A 12 hour cache would be nice. Rebuilding the whole site for each change seems didnā€™t seem like a great solution.

I see @jp thank you for the additional details.

Maybe you want to try this experimental feature that they have just launched with v9.4: https://nextjs.org/blog/next-9-4#incremental-static-regeneration-beta ā€œIncremental Static Regenerationā€ ?

Seems exactly what you are looking for, right?

Yup. Looks promising. Going to give it a shot.

1 Like