Always cache miss
Unanswered
Akita posted this in #help-forum
AkitaOP
Hello! I get always cache miss, this is my function
const getAllBranches = cache(
async () => {
const res = await fetch(returnApiUrl('/api/branch'), {
headers: { Cookie: cookies().toString() },
});
})10 Replies
AkitaOP
if i use cache: 'force-cache' it works, i get cache HIT, but i dont think this is a solution
Because you’re invoking
cookies, that will opt out of caching by defaultEvery user has their own cookies, you shouldn’t cache it
AkitaOP
i got it, but
i m using cache() function
i think it should work
It’s for dedup (aka memorisation), which is a React feature
AkitaOP
how can i resolve that?
AkitaOP
can someone help me with this?
Sorry for delay, currently you don’t have other ways to cache it without “force-cacheâ€. This is definitely a solution as that’s why it’s created