Custom Cache plugin in Fastify using hooks and node-cache.
Timestamps:
- Intro - 0:00
- What we’ve done so far - 0:40
- Setting up the cache plugin and node-cache module - 1:16
- Setting up the custom cache with hooks (onRequest) - 2:37
- Setting up the custom cache with hooks (onSend) - 5:12
- Setting up a TTL for the keys of the cache - 7:05
- Using Fastify Plugin to enable access from parent context - 7:45
- Adding function to handle node-cache’s ‘expired’ event - 8:39
- Adding console logging - 9:33
- Fixing parameters of ‘expired’ event handler (key, value) - 11:20
- Testing custom cache - 11:36
- Outro - 12:43
#fastify