Reputation: 1
I need to write a Lua script for inserting 100K records in Redis. The data structure identified in Hash. Sample Redis: redis.call('hmset', 'key1', 'field1','value1')
I am using below script but it needs to be called multiple times redis.call('hmset', KEYS[1], unpack(ARGV))
I need a Lua script which accepts list of string and list of map, so that I can use a for
loop and insert all records in one shot.
Any sample script would be much appreciated.
Upvotes: 0
Views: 1028
Reputation: 50112
This appears to do what you need:
for _, k in ipairs(KEYS) do
redis.call('HSET', k, unpack(ARGV))
end
Upvotes: 1