koa-cache-it

0.1.3 • Public • Published

Build Status NPM version

koa-cache

koa-cache is a koa middleware which provide cache for app.

Install

npm install koa-cache-it

Usage

var app = require('koa')();
var cache = require('koa-cache-it');
app.use(cache({
          store:redisStore(),
          prefix:"koa-cache-test:"
      }));
 
app.use(function * controller(){
      this.cache.get('cache-key',function * provider(){
          // do something
          return "your value";
        });
    });

APIs

  • get(key[,function *(){}])
  • set(key,value)
  • destory(key)

Readme

Keywords

Package Sidebar

Install

npm i koa-cache-it

Weekly Downloads

0

Version

0.1.3

License

LGPL V3

Last publish

Collaborators

  • hxshandle