fastify plugin for lru cache
npm install fastify-lru-cache
const fastify = require('fastify')()
const fastifyLRUCache = require('fastify-lru-cache')
fastify
.register(fastifyLRUCache, {
instance: 'lru',
max: 500
})
.ready()
fastify.listen(3000, () => {
console.log('> listening on port 3000')
})
-
instance
: (optional) the name of instance will be mapped to fastify, default iscache
- other lru-cache configurations, you can see here.