Next.js Discord

Discord Forum

Different cache-miss behavior/identifying when the cache is empty

Unanswered
Holland Lop posted this in #help-forum
Open in Discord
Holland LopOP
I'm trying to determine when a cache-miss is occurring before making a database read.

I'm using unstable_cache around a database fetching operation, and I want the initial call (the cache-miss) to differ slightly from subsequent calls (cache-hits).

Ultimately, I want the initial call to effectively SELECT * FROM x, whereas I want subsequent calls to SELECT * FROM x WHERE x.lastModified <= y.

Is there any way to achieve this in Next?

0 Replies