From ed25bf7f7e6501f83c6776a350aa3c3d697b38e7 Mon Sep 17 00:00:00 2001 From: brunocalou Date: Fri, 16 Oct 2015 18:12:20 -0300 Subject: [PATCH 1/2] Added method to get the LRU cache object --- lib/cache.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/cache.js b/lib/cache.js index 35477ff..4b6fed6 100644 --- a/lib/cache.js +++ b/lib/cache.js @@ -83,6 +83,9 @@ exports.install = module.exports.install = function(mongoose, options, Aggregate mongoose.Query.prototype.exec = function(arg1, arg2) { return exec.call(this, 'exec', arguments); }; + mongoose.getCache = function() { + return cache; + }; if (typeof Aggregate !== 'undefined') { Aggregate.prototype.exec = function(arg1, arg2) { return exec.call(this, 'execAggregate', arguments); From 2ca8db6070998eb3629fa2f59c4287bae5b941af Mon Sep 17 00:00:00 2001 From: Bruno Date: Fri, 16 Oct 2015 18:20:49 -0300 Subject: [PATCH 2/2] Update README.md --- README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.md b/README.md index 0b4d8e1..c9c06cb 100644 --- a/README.md +++ b/README.md @@ -29,3 +29,8 @@ db.User.find({ ... }).cache().exec(function() { ... }) ``` For more talky output add ```debug: true``` to the cacheOpts. + +For getting the lru cache object in order to have access to its API +```javascript +mongoose.getCache() +```