Lua script for Redis which sums the values of keys
问题 I am building out my first Redis server side script ( for debugging ) and my lack of Lua experience has me quite stuck. Essentially have a dataset of K/V pairs (containing ~1000 values) from which I want to list all the KEYS that match a pattern. For example in redis-cli: > KEYS "carlos:*" 1) "carlos:1" 2) "carlos:2" 3) "carlos:3" 4) "carlos:4" Based on the above output I want to return the sum of those keys by executing a Lua script. Currently I have the following on my sum.lua local sum = 0