Correct way to cache?
Unanswered
Russo-European Laika posted this in #help-forum
Russo-European LaikaOP
Just want to make sure I have a grasp on the code provided.
- This server action will cache for
- I can also use
Thanks!
- This server action will cache for
1 hour, meaning that if I refresh the page (let's say after 30 seconds), then a new request won't be made, but rather the cached data will be used?- I can also use
revalidateTag() to manually udpdate the cache?Thanks!
13 Replies
@garder ISR isn't a solution ?
Russo-European LaikaOP
I'm not really asking for an alternative, just want to know if I understand what the code snippet is doing correctly
If that's not what's happening, I'll definitely look into ISR
@Russo-European Laika If that's not what's happening, I'll definitely look into ISR
ISR IS the native way for caching in NextJs
For Pages Router : https://nextjs.org/docs/pages/building-your-application/data-fetching/incremental-static-regeneration
And for App Router it's just that :
For Pages Router : https://nextjs.org/docs/pages/building-your-application/data-fetching/incremental-static-regeneration
And for App Router it's just that :
Russo-European LaikaOP
so I'm already using ISR..?
@Russo-European Laika so I'm already using ISR..?
It look like you are 😅
So yes, you are doing great ðŸ‘ðŸ»
Russo-European LaikaOP
Ok, so what I said is how the code will behave?
Just want to make sure I got that right
ty btw
Actually it will revalidate After the Time (In second) you have set, and will refetch again and start another timeout...
Russo-European LaikaOP
This server action will cache for 1 hour, meaning that if I refresh the page (let's say after 30 seconds), then a new request won't be made, but rather the cached data will be used?So this is true?