You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've written a script to sum over a series of values in Redis:
local sum = 0
local k
local v
for k,v in pairs(KEYS) do
local counter_value = redis.call('get', v)
if (counter_value ~= nil) then
sum = sum + tonumber(counter_value)
end
end
return sum
When I run the script with my array of keys (which, if they exist, point to numbers created by the INCR command), I get the error user_script:7: attempt to perform arithmetic on a nil value. This tells me that whatever is being returned from redis.call('get', v) isn't just a bare string or number or nil or anything. The documentation doesn't tell us anything either - it just spits the results of redis.call() directly into the script output.
What is the format of the value returned by redis.call()?
The text was updated successfully, but these errors were encountered:
I've written a script to sum over a series of values in Redis:
When I run the script with my array of keys (which, if they exist, point to numbers created by the
INCR
command), I get the erroruser_script:7: attempt to perform arithmetic on a nil value
. This tells me that whatever is being returned fromredis.call('get', v)
isn't just a bare string or number ornil
or anything. The documentation doesn't tell us anything either - it just spits the results ofredis.call()
directly into the script output.What is the format of the value returned by
redis.call()
?The text was updated successfully, but these errors were encountered: