# node-cache-middleware

> Simple caching middleware for Connect/Express-based applications

Latest version **1.0.0** (published 2016-09-23) · MIT license · 0 weekly downloads

## Install

```sh
npm install node-cache-middleware
pnpm add node-cache-middleware
yarn add node-cache-middleware
bun add node-cache-middleware
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2016-09-23 |
| First published | 2016-09-23 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | https://github.com/Kuzmin |
| Maintainers | alexanderkuzmin |

## Links

- npm: https://www.npmjs.com/package/node-cache-middleware
- Repository: https://github.com/kuzmin/node-cache-middleware
- Homepage: https://github.com/kuzmin/node-cache-middleware#readme
- Issues: https://github.com/kuzmin/node-cache-middleware/issues
- npm.io page: https://npm.io/package/node-cache-middleware

## Dependencies (3)

- [lodash](https://npm.io/package/lodash.md) ^4.16.1
- [bluebird](https://npm.io/package/bluebird.md) ^3.4.6
- [memory-cache](https://npm.io/package/memory-cache.md) ^0.1.6

## Recent versions

- 1.0.0 (latest) — 2016-09-23

## README

# node-cache-middleware

Express middleware to cache API routes

![Travis](https://travis-ci.org/Kuzmin/node-cache-middleware.svg)

## The basics

``` JavaScript
const cacheMiddleware = require('node-cache-middleware');

app.get(
    '/slow_endpoint',
    cacheMiddleware({
        durationMilliseconds: 30 * 1000,
    }),
    (req, res, next) => "..."
);
```

## Caching backends

This comes with a in-memory cache using the Node `memory-cache` package.
It does support writing your own adapter for memcached/redis or whatever else
floats your boat.

## Credits

Based on [kwhitley/apicache](https://github.com/kwhitley/apicache), and [addisonj/node-cacher](https://github.com/addisonj/node-cacher), but with some changes to better
handle the thundering herd problem.

---
_Source: https://npm.io/package/node-cache-middleware · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
