Skip to content

Commit 6bc48ce

Browse files
author
bravemaster619
committed
fix: swap value and ttl when ttl is missing
1 parent abcf83a commit 6bc48ce

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

_src/lib/node_cache.coffee

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,9 @@ module.exports = class NodeCache extends EventEmitter
218218
_ret = @get( key )
219219
if _ret?
220220
return _ret
221+
if typeof value == 'undefined'
222+
value = ttl
223+
ttl = undefined
221224
_ret = if typeof value == 'function' then value() else value
222225
@set( key, _ret, ttl )
223226
return _ret

0 commit comments

Comments
 (0)