Next.js Discord

Discord Forum

Question about the new cacheTag/revalidateTag for user specific tags

Unanswered
Gascon Saintongeois posted this in #help-forum
Open in Discord
Avatar
Gascon SaintongeoisOP
Hi everyone! I'm trying out the new use cache pattern (https://nextjs.org/docs/canary/app/api-reference/functions/cacheTag#combining-with-revalidatetag) and I had a question about user specific caching. For each user would I have to pass in my user id like

cacheTag(`${user.id}-posts`)


So that I don't overlap a cache with another user?

Additionally if I ran the following code

revalidateTag(`${user.id}-posts`)


Somewhere else in a different endpoint, would it be revalidated for the currently logged in user?

1 Reply

Avatar
Gascon Saintongeois
I have this exact same question!