0.0.3 • Published 6 years ago

url-cache-feng v0.0.3

Weekly downloads
1
License
MIT
Repository
-
Last release
6 years ago

Introduction

url cache middleware of koa

NOTE

only cache url of GET

Usage

npm install --save url-cache-feng

const app=require('koa')();
const match=require('url-match-feng');
const cache=require('url-cache-feng');
const Redis=require('ioredis');
const redis=new Redis();

const routesconfig={
     '/index': { method: 'GET', cache: 300, main: 'index', type: 'html' },
    '/channel': { method: 'GET', cache: 200, main: 'channel', type: 'html' },
};

app.use(match({routesConfig}));
app.use(cache({engine:redis,prefix:'app'}));

app.listen(3000);

options

  • engine

    cache service ,the service shuold have function get and setex

  • prefix

    the perfix of key ,default: 'app'

0.0.3

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago