Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

client.set expire #1413

Closed
loretoparisi opened this issue Feb 15, 2019 · 1 comment
Closed

client.set expire #1413

loretoparisi opened this issue Feb 15, 2019 · 1 comment
Labels

Comments

@loretoparisi
Copy link

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?

@loretoparisi loretoparisi changed the title client.set cache client.set expire Feb 15, 2019
@BridgeAR
Copy link
Contributor

BridgeAR commented May 7, 2019

Both are OK. This is independent from node_redis and just how Redis itself works. Please do not ask generic Redis questions here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants