Next.js Discord

Discord Forum

How does `unstable_cache` work with optional parameters?

Unanswered
Plague posted this in #help-forum
Open in Discord
I'm curious to know how the caching behavior works for unstable_cache when passing optional parameters to the function, does it only cache a version of the function with/without said parameters, does it only cache the most recently called version, or does it work like how I would think and cache both results whenever a version of the function is called.

In my case, I want to be able to cache both the versions of the function as they produce different results from the API.

0 Replies