trying to cache api routes
Hello.
I am using TRPC to make a site which integrates with a third party API. I need to add caching to some of my routes.
I have tried to implement a temporary global cache, as seen below. In order to stop rate limits for the third party api.
However, the cache-control header does not get changed, and nothing is cached. Mutiple requests are still made to the third party API.
The
cache
code does run, as the console.log(2)
appears in console.
Any clue whats wrong?4 Replies
bump
can you make a reproduction and post an issue?
this should work and it has worked in the past, can't confirm or deny if this is a bug without testing it myself
yes, once I get some spare time i will try to make a reproduction.
hi, did u manage to fix it?