Next.js Discord

Discord Forum

Understanding "use cache' caching behaviour

Unanswered
Sloth bear posted this in #help-forum
Open in Discord
Sloth bearOP
I'm struggling with understanding how next'js caches data when using the use cache directive.
My main question is does nextjs cache data globally for all users to use.
Reading docs it says it generates the cache key by using the function id and the functions args. Does nextjs cache this data globally using the generated key? If it does my concern would then be around security if fetching say a users id inside the function instead of passing it through args and using it to fetch data and cache it would this then not be shown to everyone calling that same function which would then hit the cache?

Any help would be much appreciated thanks

0 Replies