diff --git a/index.js b/index.js index 9bea1bc..c4bb21e 100644 --- a/index.js +++ b/index.js @@ -90,9 +90,8 @@ NanoCache.prototype = { var epoch = this.now(); var json = JSON.stringify(value); - var compressed = this.options.compress; - var store_value = compressed + var store_value = opt.compress ? zlib.deflateRawSync(json) : json; @@ -108,7 +107,7 @@ NanoCache.prototype = { value : store_buffer, bytes : bytes, ttl: opt.ttl, - compressed: compressed, + compressed: opt.compress, cost: opt.cost || 1, limit: opt.limit }; diff --git a/test/test.js b/test/test.js index 7fc0fad..63d8cf0 100644 --- a/test/test.js +++ b/test/test.js @@ -289,7 +289,7 @@ var testCache = function (cache) { }; describe('Singleton', function () { - //testCache(NanoCache); + testCache(NanoCache); }); describe('Instance', function () {