Gottox / mongoose-cache

Caches Database querys the easy way. This module is currently not developed. Nevertheless, I will apply patches.
MIT License
36 stars 23 forks source link

allow disabling of cache to optionally query for latest results #8

Open hunterloftis opened 10 years ago

hunterloftis commented 10 years ago

Frequently, you want to be able to force a full update on a normally-cached query. This PR allows you to select to cache or not with a boolean argument like:

function query(fresh, done) {
  this.find()
    .sort('-createdAt')
    .limit(n || 50)
    .cache(!fresh)
    .exec(done);
}