Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jean-smaug/koache
Koa middleware for caching response, based on node-cache
https://github.com/jean-smaug/koache
cache koa middleware
Last synced: 3 months ago
JSON representation
Koa middleware for caching response, based on node-cache
- Host: GitHub
- URL: https://github.com/jean-smaug/koache
- Owner: jean-smaug
- Created: 2018-11-24T19:13:59.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2018-11-26T21:40:53.000Z (almost 6 years ago)
- Last Synced: 2024-07-19T20:05:27.911Z (4 months ago)
- Topics: cache, koa, middleware
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/koache
- Size: 32.2 KB
- Stars: 6
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-koa - koache - Koa cache based on node-cache (Middleware)
README
# Koache
[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](http://standardjs.com)
Koache is small middleware using [node-cache](https://github.com/mpneuried/nodecache) to cache requests.
Koache will cache each path of your application, so you can use it in combination of [koa-router](https://github.com/alexmingoia/koa-router)```js
const Koa = require("koa");
const cache = require("koache");const app = new Koa();
// See node-cache documentation to see allowded options
app.use(cache({ stdTTL: 10 }));app.use(async ctx => {
ctx.body = "smaug";
});app.listen(3001, () => console.log("listening..."));
```