1.0.4 • Published 3 years ago

express-api-cache v1.0.4

Weekly downloads
49
License
ISC
Repository
github
Last release
3 years ago

express-api-cache

Caching is a commonly used technique to improve the performance of any application, be it desktop, mobile or web. express-api-cache enable server-side cache for Express API to has more faster response from your API.

Cache a route Ready to use sample

var express = require("express");
var app = express();
var cacheService = require("express-api-cache");
var cache = cacheService.cache;

app.get("/movies", cache("10 minutes"), (req, res) => {
  // Do some work to retrieve movies and request before 10 minutes will get movies from cache
  res.json([
    {
      title: "The Lord of the Rings",
      director: "Peter Jackson",
    },
    { title: "Memento", director: "Christopher Nolan" },
  ]);
});

app.listen(3000, function () {
  console.log(`Example app listening on 3000!`);
});

API

  • valid units - ms, second, minute, hour, day, week, month.
  • duration format - time as 5 minutes
1.0.4

3 years ago

1.0.3

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago

0.2.1

9 years ago

0.2.0

9 years ago

0.1.2

9 years ago

0.1.1

9 years ago

0.1.0

9 years ago