Skip to content

Instantly share code, notes, and snippets.

@lyhcode
Created May 14, 2012 12:45
Show Gist options
  • Save lyhcode/2693746 to your computer and use it in GitHub Desktop.
Save lyhcode/2693746 to your computer and use it in GitHub Desktop.
Node.js + express + connect-cache
var express = require('express')
, routes = require('./routes')
, cache = require('connect-cache');
// all urls contains "cached" will be cached for 1min. e.g. /services/cached/list.json
var app = module.exports = express.createServer(
cache({rules: [
{regex: /\/cached\/.*/, ttl: 60 * 1000}
]})
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment