How can I cache a single procedure?
I've seen the docs on caching here: https://trpc.io/docs/caching
But that is caching the entire app router.
my app router has many "subrouters" (Not sure what you call them) and I need different cache times for different "procedures" in those routers.
For example I have some data that I would only want a 5 minute cache time for, but other data that can be cached for a week with no issues.
How can I apply a specific cache time to a procedure in trpc?
I tried using the
For example I have a component that does multiple trpc queries, where some of those can be cached for a week without problems and others needs to be updated at least once a minute.
But that is caching the entire app router.
my app router has many "subrouters" (Not sure what you call them) and I need different cache times for different "procedures" in those routers.
For example I have some data that I would only want a 5 minute cache time for, but other data that can be cached for a week with no issues.
How can I apply a specific cache time to a procedure in trpc?
I tried using the
paths array in the app level caching, but it seems to sometimes include both paths that I want long caching for and paths that needs short caching? So I don't know how I would be able to use that to change the cache time properly.For example I have a component that does multiple trpc queries, where some of those can be cached for a week without problems and others needs to be updated at least once a minute.
The below examples uses Vercel's edge caching to serve data to your users as fast as possible.