| 1 |
local result = {} |
| 2 |
|
| 3 |
local function lengthOfList (key) |
| 4 |
return redis.call("LLEN", key) |
| 5 |
end |
| 6 |
|
| 7 |
redis.call("SELECT", DB_NO) |
| 8 |
|
| 9 |
local keysPresent = redis.call("KEYS", "KEYS_PATTERN") |
| 10 |
|
| 11 |
if keysPresent ~= nil then |
| 12 |
for _,key in ipairs(keysPresent) do |
| 13 |
|
| 14 |
|
| 15 |
local status, retval = pcall(lengthOfList, key) |
| 16 |
|
| 17 |
if status == true then |
| 18 |
local keyName = "redis_list_length_" .. key |
| 19 |
local keyValue = retval .. "" |
| 20 |
table.insert(result, keyName) |
| 21 |
table.insert(result, keyValue) |
| 22 |
end |
| 23 |
end |
| 24 |
end |
| 25 |
|
| 26 |
return result |