HeyPuter/kv.js

Expire with NX option

kerhong opened this issue · 1 comments

Saw your project on https://news.ycombinator.com/item?id=35608601 and the expires command seems wrong

kv.js/README.md

Lines 119 to 120 in 596ba10

// Set a key's time to live in seconds only if the key does not exist
kv.expire('username', 120, 'NX');

Shouldn't kv.expire('username', 120, 'NX'); mean "Set expirity of username to 60 seconds if it has no expirity"? The documentation suggests "Set expirity of username to 60 seconds if username does not exist" which makes no sense (as the key does not exist and thus can't have expirity).

See redis docs for reference/suggestion https://redis.io/commands/expire/

jelveh commented

Thank you for reporting this. You are correct, this is a mistake.