Skip to content
/ cache Public
forked from zcorky/koa-cache-hits

simple cache hit, support custom db dependency

License

Notifications You must be signed in to change notification settings

koexjs/cache

 
 

Repository files navigation

cache

NPM version NPM quality Coverage Status Dependencies Build Status Known Vulnerabilities NPM download license issues

cache for koa extend. And you can custom auto cache db, like redis.

Install

$ npm install @koex/cache

Usage

// See more in test
import cache from '@koex/cache';

import * as Koa from 'koa';
const app = new Koa();
app.use(cache(options));
app.use(async (ctx) => {
  if (ctx.path === '/') {
    ctx.body = 'hello, world';
  } else if (ctx.path === '/json') {
    ctx.body = {
      name: 'name',
      value: 'value',
    };
  }
});

app.listen(8000, '0.0.0.0', () => {
  console.log('koa server start');
});

Related

About

simple cache hit, support custom db dependency

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • TypeScript 100.0%