Lua script with multi operations not working in redis -
just started playing lua scripting in redis, want execute following commands in script:
set k1 foo set k2 bar
tried..
> eval "redis.call('set', keys[1],'foo'); redis.call('set',keys[2],'bar'); return 1;" 1 k1 2 k2
> script load "redis.call('set', keys[1],'foo'); redis.call('set',keys[2],'bar'); return 1;" > "bb031c00b6ab2508bbf182dadd5c9bf1675cce56" > evalsha "bb031c00b6ab2508bbf182dadd5c9bf1675cce56" 1 k1 2 k2
results
get k1 1) "foo" k2 (nil)
why k2
not set; script and/or syntax not correct?
the way call now, passes in 1 key name (k1
) , 2 arguments (2
, k2
).
i think want be
eval "redis.call('set', keys[1], 'foo'); redis.call('set', keys[2],'bar'); return 1;" 2 k1 k2
Comments
Post a Comment