Node-redis: Support of set with options

Created on 11 Jul 2013  ·  3Comments  ·  Source: NodeRedis/node-redis

http://redis.io/commands/set supports options like XX. Is it possible to use them? I tried

client.set(key, value, "PX expiry", function (err) {});
client.set(key, value, {PX:  expiry}, function (err) {});

which does not work.

question

Most helpful comment

Could this be clarified with regards to expiry (like http://redis.io/commands/expire) in the documentation for node_redis?

All 3 comments

It does indeed work! :smile_cat:

Set "foo" to "bar" expiring in 10 seconds, but only if key "foo" already exists:

r.set("foo", "bar", "EX", 10, "XX")

That's even quiet obvious... :D thanks!

Could this be clarified with regards to expiry (like http://redis.io/commands/expire) in the documentation for node_redis?

Was this page helpful?
0 / 5 - 0 ratings