Skip to content
A small middleware library for setting cache control headers
CoffeeScript JavaScript
Latest commit 513a7aa Sep 11, 2013 @addisonj addisonj add in license, fixes #6
Failed to load latest commit information.
.gitignore rewrite Nov 3, 2012
LICENSE add in license, fixes #6 Sep 11, 2013
README.md add in license, fixes #6 Sep 12, 2013
cache.js fix obvious bug, need tests Nov 5, 2012
package.json Allow newer versions of node Sep 11, 2013
tests.coffee add one more test Dec 5, 2012

README.md

express-cache-control

Add caching to your requests in 4 easy steps!

  1. Install: npm install --save express-cache-control

  2. Require: var CacheControl = require("express-cache-control")

  3. Instantiate: var cache = new CacheControl().middleware

  4. Mixin it: app.get("/routetocache", cache("hours", 3), routes.get)

Other stuff:

  • Override caching for development: var cache = new CacheControl({override: 0}).middleware

  • The middleware method is bound to the CacheControl instance so you can treat it like a real function var cache = new CacheControl({override: 0}).middleware

  • leave off the value to assume 1 cache("hour")

cache for: seconds minutes hours days weeks months years

License

Copyright (c) 2013 i.TV LLC

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Something went wrong with that request. Please try again.