solr-client-cache
Advanced tools
Comparing version 1.0.1 to 1.1.0
@@ -10,3 +10,7 @@ 'use strict'; | ||
solrClient.search = function (query, callback) { | ||
solrClient.search = function (query, ignoreCache, callback) { | ||
if (arguments.length === 2 && typeof ignoreCache === 'function') { | ||
callback = ignoreCache; | ||
ignoreCache = undefined; | ||
} | ||
if (typeof this.cacheOptions !== 'object' || | ||
@@ -23,3 +27,3 @@ !this.cacheOptions.hasOwnProperty('ttl')) { | ||
.then(cachedResults => { | ||
if (cachedResults) { | ||
if (cachedResults && !ignoreCache) { | ||
// set debug flag | ||
@@ -26,0 +30,0 @@ Object.defineProperty(cachedResults, '__fromCache', { value: true }); |
{ | ||
"name": "solr-client-cache", | ||
"version": "1.0.1", | ||
"version": "1.1.0", | ||
"description": "Caching for Solr Client", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -179,2 +179,10 @@ 'use strict'; | ||
it('should NOT cache a query when the config is overriden', (done) => { | ||
solrClient.cache().search({}, true, (err, results) => { | ||
should.not.exist(err); | ||
results.should.not.have.property('__fromCache'); | ||
done(); | ||
}); | ||
}); | ||
it('should NOT save the results to cache', (done) => { | ||
@@ -181,0 +189,0 @@ solrClient.search({}, (err, results) => { |
14781
272