Gowthamss
Gowthamss

Reputation: 241

How to write Redis 'mset' programmatically in node.js?

I have multiple keys and values which I can set to Redis by calling 'set' method multiple times which just takes (key, value).

How can I do the same with Redis 'mset' command and pass those key,value pairs?

Upvotes: 0

Views: 1078

Answers (1)

Leibale Eidelman
Leibale Eidelman

Reputation: 3184

using ioredis:

client.MSET('key1', 'value1', 'key2', 'value2');

using node-redis:

client.MSET({ 'key1': 'value1', 'key2': 'value2' });
client.MSET(['key1', 'value1', 'key2', 'value2']);
client.MSET([['key1', 'value1'], ['key2', 'value2']]);

Upvotes: 2

Related Questions