Hmm ok, but let's say there is a trpc implementation and it has a bunch of routers that are loaded d

Hmm ok, but let's say there is a trpc implementation and it has a bunch of routers that are loaded dynamically to avoid loading a big chunk of javascript for no reason. The most procedures do some database operation. However, to follow the advice that the same running worker (I assume it's alive for some time it won't die after the first fetch) should not consider any caching, a route to a procedure would need to be loaded dynamically every time with the latest env.DB passed into drizzle or used directly for a db operation. Is that a suggested approach?

I'm trying to understand if I should think about a worker as a lightweight express server that can be restarted any time but for the period when it's not restarted it can leverage some scoped caching or if this approach can cause some trouble and everything should be created fresh on every request.
Was this page helpful?