buffering-cache
Advanced tools
Comparing version 1.0.3 to 1.0.4
@@ -20,2 +20,4 @@ const Promise = require('bluebird'); | ||
self.cient = params.store.client; | ||
if (typeof ttl !== 'number' || ttl < 0) { | ||
@@ -79,2 +81,6 @@ throw new Error('ttl must be a number greater than 0'); | ||
if (typeof store.client !== 'object') { | ||
throw new Error('store.client must be an object'); | ||
} | ||
if (typeof store.get !== 'function' || store.get.length < 1) { | ||
@@ -81,0 +87,0 @@ throw new Error('store.get must be a function that takes a parameter for key'); |
@@ -17,3 +17,4 @@ const stringify = require('json-stable-stringify'); | ||
setpx: (key, ttl, value) => {}, | ||
delete: (key) => {} | ||
delete: (key) => {}, | ||
client: {} | ||
}, | ||
@@ -20,0 +21,0 @@ ttl: remoteCacheSpec.bufferTtl |
{ | ||
"name": "buffering-cache", | ||
"version": "1.0.3", | ||
"version": "1.0.4", | ||
"description": "Node cache wrapper that keeps your cache warm", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -16,3 +16,4 @@ const chai = require('chai'); | ||
delete: (key) => {}, | ||
pttl: (key) => {} | ||
pttl: (key) => {}, | ||
client: {} | ||
}, | ||
@@ -50,3 +51,4 @@ ttl: 60, | ||
return ttlMsec; | ||
} | ||
}, | ||
client: {} | ||
}, | ||
@@ -83,3 +85,4 @@ ttl: 60, | ||
localArgs.ttl = key; | ||
} | ||
}, | ||
client: {} | ||
}, | ||
@@ -141,3 +144,4 @@ ttl: 10 | ||
return ttlMsec; | ||
} | ||
}, | ||
client: {} | ||
}, | ||
@@ -173,3 +177,4 @@ ttl: 60, | ||
localArgs.ttl = key; | ||
} | ||
}, | ||
client: {} | ||
}, | ||
@@ -233,3 +238,4 @@ ttl: 10 | ||
return ttlMsec; | ||
} | ||
}, | ||
client: {} | ||
}, | ||
@@ -265,3 +271,4 @@ ttl: 60, | ||
localArgs.ttl = key; | ||
} | ||
}, | ||
client: {} | ||
}, | ||
@@ -331,3 +338,4 @@ ttl: 10 | ||
delete: (key) => {}, | ||
pttl: (key) => ttlMsec | ||
pttl: (key) => ttlMsec, | ||
client: {} | ||
}, | ||
@@ -344,3 +352,4 @@ ttl: 60, | ||
setpx: (key, value, ttl) => {}, | ||
delete: (key) => {} | ||
delete: (key) => {}, | ||
client: {} | ||
}, | ||
@@ -394,3 +403,4 @@ ttl: 10 | ||
return ttlMsec; | ||
} | ||
}, | ||
client: {} | ||
}, | ||
@@ -427,3 +437,4 @@ ttl: 60, | ||
localArgs.ttl = key; | ||
} | ||
}, | ||
client: {} | ||
}, | ||
@@ -499,3 +510,4 @@ ttl: 10 | ||
return ttlMsec; | ||
} | ||
}, | ||
client: {} | ||
}, | ||
@@ -532,3 +544,4 @@ ttl: 60, | ||
localArgs.ttl = key; | ||
} | ||
}, | ||
client: {} | ||
}, | ||
@@ -535,0 +548,0 @@ ttl: 10 |
@@ -17,2 +17,3 @@ const Promise = require('bluebird'); | ||
delete: (key) => {}, | ||
client: {} | ||
}, | ||
@@ -29,2 +30,3 @@ ttl: 500 | ||
delete: (key) => {}, | ||
client: {} | ||
}, | ||
@@ -50,2 +52,3 @@ ttl: 500 | ||
delete: (key) => {}, | ||
client: {} | ||
}, | ||
@@ -66,7 +69,14 @@ ttl: 500 | ||
expect(() => new Cache({})).to.throw(/object/); | ||
expect(() => new Cache({store: {}})).to.throw(/store.get/); | ||
expect(() => new Cache({store: {}})).to.throw(/store.client/); | ||
expect(() => new Cache({ | ||
store: { | ||
get: () => {} | ||
client: {} | ||
} | ||
})).to.throw(/store.get/); | ||
expect(() => new Cache({ | ||
store: { | ||
client: {}, | ||
get: () => {} | ||
} | ||
})).to.throw(/store\.get/); | ||
@@ -76,3 +86,4 @@ | ||
store: { | ||
get: (key) => {} | ||
client: {}, | ||
get: (key) => {} | ||
} | ||
@@ -83,4 +94,5 @@ })).to.throw(/store\.setpx/); | ||
store: { | ||
get: (key) => {}, | ||
setpx: () => {} | ||
client: {}, | ||
get: (key) => {}, | ||
setpx: () => {} | ||
} | ||
@@ -91,4 +103,5 @@ })).to.throw(/store\.setpx/); | ||
store: { | ||
get: (key) => {}, | ||
setpx: (key, value, ttl) => {} | ||
client: {}, | ||
get: (key) => {}, | ||
setpx: (key, value, ttl) => {} | ||
} | ||
@@ -99,2 +112,3 @@ })).to.throw(/store\.delete/); | ||
store: { | ||
client: {}, | ||
get: (key) => {}, | ||
@@ -108,2 +122,3 @@ setpx: (key, value, ttl) => {}, | ||
store: { | ||
client: {}, | ||
get: (key) => {}, | ||
@@ -117,2 +132,3 @@ setpx: (key, value, ttl) => {}, | ||
store: { | ||
client: {}, | ||
get: (key) => {}, | ||
@@ -127,2 +143,3 @@ setpx: (key, value, ttl) => {}, | ||
store: { | ||
client: {}, | ||
get: (key) => {}, | ||
@@ -137,2 +154,3 @@ setpx: (key, value, ttl) => {}, | ||
store: { | ||
client: {}, | ||
get: (key) => {}, | ||
@@ -139,0 +157,0 @@ setpx: (key, value, ttl) => {}, |
46955
1176