Skip to content

Commit

Permalink
compress can be passed in at an item level
Browse files Browse the repository at this point in the history
  • Loading branch information
cxgk committed May 10, 2017
1 parent 3f79acb commit f2401a9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
5 changes: 2 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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
};
Expand Down
2 changes: 1 addition & 1 deletion test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ var testCache = function (cache) {
};

describe('Singleton', function () {
//testCache(NanoCache);
testCache(NanoCache);
});

describe('Instance', function () {
Expand Down

0 comments on commit f2401a9

Please sign in to comment.