fortis / koa-boost

Cache middleware for koa
1 stars 0 forks source link
cache koa koa-boost koa-cache koa-middleware koa2 koajs

koa-boost

Greenkeeper badge

travis-ci status coverage status npm version Standard - JavaScript Style Guide

Cache middleware for koa.

Installation

npm install koa-boost --save

Usage

Store Cache in Application Memory
const Koa = require('koa')
const boost = require('koa-boost')

const app = new Koa()
app.use(boost({
  pattern: '/api/*',
  ttl: 60 // 60 seconds
}));
Use Redis as Cache Provider
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
}));

Options