Skip to content

Kuzmin/node-cache-middleware

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

node-cache-middleware

Express middleware to cache API routes

Travis

The basics

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, and addisonj/node-cacher, but with some changes to better handle the thundering herd problem.

About

Basic caching middleware for Express/Connect-based apps

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published