I have been using the cache so far in this way
self.client.set(key, value, 'EX', _expire, function(err, res) {
// res is null when the key is missing
if(err) self.logger.error("RedisStore.set err %@", err);
else self.logger.debug("RedisStore.set %@", key);
return callback(err, res);
});
passing the EX
, and setting a variable expressed in seconds.
I see from tests that it is used in a different way
client.set(['ttl key', 'ttl val'], helper.isString('OK'));
client.expire(['ttl key', '100'], helper.isNumber(1));
client.TTL(['ttl key'], function (err, ttl) {
assert(ttl >= 99);
assert(ttl <= 100);
done(err);
});
Which is the correct way in the current version?
Both are OK. This is independent from node_redis and just how Redis itself works. Please do not ask generic Redis questions here.