LRU-based caching middleware for Node.js that patches res.send
.
- 😲 ~336x faster for heavy operations
- ⚡ ESM-only
- ✨ types out of the box
- 🟥 (optionally) supports Redis
pnpm i lru-send
import { lruSend } from 'lru-send'
import { App } from '@tinyhttp/app'
const app = new App()
app.use(lruSend())
app.use('/', (_req, res) => {
someUltraHeavyOp()
res.send('hello')
})
app.listen(3000)
import { lruSend } from 'lru-send/redis'
import { App } from '@tinyhttp/app'
import Redis from 'ioredis'
const redis = new Redis()
const app = new App()
app.use(lruSend(redis))
app.use('/', (_req, res) => {
someUltraHeavyOp()
res.send('hello')
})
app.listen(3000)