@melroy89
Software Engineer
Nothing here yet.
Nothing here yet.
No blogs yet.
If you are more advanced... And understand the examples above. You could also checkout the Platformatic code, if you want to see a template style of implementing it, thus it can be used in a very general way: https://github.com/platformatic/platformatic/blob/b0cbad33354dacf2f018ddf4d62bee4f412b420c/packages/sql-mapper/lib/cache.js#L2 Then the setupCache method is used here: https://github.com/platformatic/platformatic/blob/b0cbad33354dacf2f018ddf4d62bee4f412b420c/packages/sql-mapper/mapper.js#L10
I guess implement the package yourself in your Fastify app: https://github.com/mcollina/async-cache-dedupe I guess just adding a cache behind each DB call? See some TS example code: https://github.com/mcollina/async-cache-dedupe?tab=readme-ov-file#typescript Here another example implementation: https://github.com/Shyam-Chen/Fastify-Starter/blob/a1746035a40bf49d5d095b0b2c16cfa5e2493a40/app/src/routes/hello-world/caching-dedupe/%5Bid%5D-redis/%2Bhandler.ts#L4