upstash / redis-js

HTTP based Redis Client for Serverless and Edge Functions
https://docs.upstash.com/redis
MIT License
668 stars 51 forks source link

Next 13 will set cache: 'force-cache' for all GET requests #330

Closed kay-is closed 1 year ago

kay-is commented 1 year ago

When using the new app router of Next 13, GET requests will cache every response by default.

https://beta.nextjs.org/docs/data-fetching/fetching#static-data-fetching

My quick fix for this is to either use the Upstash Redis REST API, or to use a pipeline with the SDK and throw in a p.set("cacheBuster", Math.random()), to force the SDK to use a POST request.

I had the same issue with the Kafka SDK.

chronark commented 1 year ago

hang on, the sdk always uses post. I'm confused now why the pipeline would make a difference

kay-is commented 1 year ago

Ah, maybe it also caches with POST, but since the Request looks different with the cachebuster, it misses.

chronark commented 1 year ago

It's on my to-do list for next week

chronark commented 1 year ago

We fixed this recently, please upgrade to latest