Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Caches Database querys the easy way. This module is currently not developed. Nevertheless, I will apply patches.
JavaScript
branch: master
Failed to load latest commit information.
lib linting fixes
LICENSE initial checkin
README.md initial checkin
index.js initial checkin
package.json release v0.1.2

README.md

Flattr this git repo

mongoose-cache

Monkey patches Mongoose.Query to support in-memory caching.

usage

Monkey-Patching mongoose:

var mongoose = require('./mongoose')
var cacheOpts = {
    max:50,
    maxAge:1000*60*2
};
require('mongoose-cache').install(mongoose, cacheOpts)

This means "cache up to 50 querys with a livetime of two minutes". See https://github.com/isaacs/node-lru-cache#options for all available options.

For enabling this cache in your query just call .cache()

db.User.find({ ... }).cache().exec(function() { ... })

For more talky output add debug: true to the cacheOpts.

Something went wrong with that request. Please try again.