Comparing version 1.0.3 to 1.0.4
{ | ||
"name": "keyv", | ||
"version": "1.0.3", | ||
"version": "1.0.4", | ||
"description": "Simple key-value storage with support for multiple backends", | ||
@@ -37,3 +37,2 @@ "main": "src/index.js", | ||
"coveralls": "^2.13.1", | ||
"delay": "^2.0.0", | ||
"eslint-config-xo-lukechilds": "^1.0.0", | ||
@@ -40,0 +39,0 @@ "keyv-mongo": "*", |
@@ -66,3 +66,8 @@ 'use strict'; | ||
key = this._getKeyPrefix(key); | ||
ttl = ttl || this.opts.ttl; | ||
if (typeof ttl === 'undefined') { | ||
ttl = this.opts.ttl; | ||
} | ||
if (ttl === 0) { | ||
ttl = undefined; | ||
} | ||
const store = this.opts.store; | ||
@@ -69,0 +74,0 @@ |
@@ -71,3 +71,15 @@ import test from 'ava'; | ||
test.serial('.set(key, val, ttl) where ttl is "0" overwrites default tll option and sets key to never expire', async t => { | ||
const startTime = Date.now(); | ||
tk.freeze(startTime); | ||
const store = new Map(); | ||
const keyv = new Keyv({ store, ttl: 200 }); | ||
await keyv.set('foo', 'bar', 0); | ||
t.is(await keyv.get('foo'), 'bar'); | ||
tk.freeze(startTime + 250); | ||
t.is(await keyv.get('foo'), 'bar'); | ||
tk.reset(); | ||
}); | ||
const store = () => new Map(); | ||
keyvTestSuite(test, Keyv, store); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
21184
13
196