Skip to content

Commit

Permalink
add skip_scripts.lua
Browse files Browse the repository at this point in the history
  • Loading branch information
suxb201 committed Sep 22, 2022
1 parent 0fd2c5d commit 8a444ac
Show file tree
Hide file tree
Showing 6 changed files with 4,990 additions and 748 deletions.
3 changes: 0 additions & 3 deletions filters/print.lua
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@
--- @db_id number: redirection database id

function filter(id, is_base, group, cmd_name, keys, slots, db_id, timestamp_ms)
local keys_size = #keys
local slots_size = #slots -- slots_size should be equal to keys_size

print(string.format("lua filter. id=[%d], is_base=[%s], db_id=[%d], group=[%s], cmd_name=[%s], keys=[%s], slots=[%s], timestamp_ms=[%d]",
id, tostring(is_base), db_id, group, cmd_name, table.concat(keys, ", "), table.concat(slots, ", "), timestamp_ms))
return 0, db_id
Expand Down
8 changes: 8 additions & 0 deletions filters/skip_scripts.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
-- skip all scripts included LUA scripts and Redis Functions.
function filter(id, is_base, group, cmd_name, keys, slots, db_id, timestamp_ms)
if group == "SCRIPTING" then
return 1, db_id -- disallow
else
return 0, db_id -- allow
end
end
2 changes: 0 additions & 2 deletions filters/swap_db.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@
--- dbid: others -> drop
function filter(id, is_base, group, cmd_name, keys, slots, db_id, timestamp_ms)
if db_id == 0 then
-- print("db_id is 0, redirect to 1")
return 0, 1
elseif db_id == 1 then
-- print("db_id is 1, redirect to 0")
return 0, 0
else
return 1, db_id
Expand Down
Loading

0 comments on commit 8a444ac

Please sign in to comment.