"use cache" data cache - vercel runtime rollout

Hey everybody!

In another thread (0 data cache usage since May 13) I have seen, that “use cache” is currently not using the data cache as it would be expected. Only “use cache: remote” uses the cache (I can not find any documentation on that though).

It was the talk about a rollout of a new runtime, that will change the “use cache” behavior. When is this rollout planned?

I am asking because I deployed an app that uses “use cache” in expensive functions (computation, database queries). In these functions, I am logging whenever they get executed. I noticed that they are executed every time. Also nothing shows up in the runtime cache in observability. Running the next.js application as a node.js process, the caching is used correctly.

I have just tried this on a preview deployment so far, does this factor in? Might the correct caching behavior already be working when using a production deployment? But that should probably not be the case as the preview should have consistent behavior.

Can you share some insights please on how to most effectively proceed here from my side?

  • Wait for the rollout
  • Switch to “use cache: remote” - if so, could you point me to the documentation please
  • Another way?

Thank you very much!

I actually have no idea what’s going on now.. Seeing this pop up in my emails prompted me to check my function invocations and now I’m seeing database queries behind use cache: remote executing on every function invocation, whereas they weren’t when I made the original thread you’ve linked.

This might even explain why my usage costs have skyrocketed since switching to fluid too :confused:

Ui, yeah that is exactly what I was afraid of for my usage, as the calculations that I do are quite expensive, financial data crunching of many transactions. So if there is no caching of that data, I would burn through cpu time very quickly.

Good thing you got notified :slight_smile:

I know that “use cache” is not deemed stable yet, so maybe the quick fix way would be to revert to unstable_cache, but i really like the “use cache” way of doing things…

I just tried reverting my usage back to "use cache" - nothing changed

Reverted to unstable_cache - now back to seeing “Using cache | Data Cache” in my function invocations and requests being cached are missing from the invocation logs.

I really don’t understand why one works and the other doesn’t, considering both are available in Next stable. Even more confused by the response from staff in my previous thread since it seems to be completely wrong.

Last I tried with unstable_cache, doing keys like post:${postId} was rather sketchy and invalidating it rarely worked properly, so for that I’m just using Upstash.

Really hope they get "use cache" sorted soon since the DX is way better.

1 Like

Thank you for trying the migration to unstable_cache. I am right with you when it comes to the DX.
I was on the verge of migrating to vercel for the hosting, but that is currently a blocker for me and I will probably hold out until “use cache” is working correctly.

Hopefully vercel can jump into this thread to clear things up and help us out :wink:

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.