Cache middleware for koa.
npm install koa-boost --save
const Koa = require('koa')
const boost = require('koa-boost')
const app = new Koa()
app.use(boost({
pattern: '/api/*',
ttl: 60 // 60 seconds
}));
const Koa = require('koa')
const boost = require('koa-boost')
const Redis = require('ioredis')
const app = new Koa()
const redis = new Redis()
app.use(boost({
provider: redis,
pattern: '/api/*',
ttl: 60 // 60 seconds
}));
pattern {string|array}
— pattern to match incoming request paths against. Supports glob matching and other
features provided by highly optimized wildcard and glob matching library micromatch. Defaults to null
— all requests will be cached.ttl {integer}
— time in seconds that cached response should remain in the cache. Defaults to 60
seconds.