diff --git a/kong/plugins/rate-limiting/policies/init.lua b/kong/plugins/rate-limiting/policies/init.lua index 80731cb0648b..12f9f32983e8 100644 --- a/kong/plugins/rate-limiting/policies/init.lua +++ b/kong/plugins/rate-limiting/policies/init.lua @@ -2,7 +2,7 @@ local policy_cluster = require "kong.plugins.rate-limiting.policies.cluster" local timestamp = require "kong.tools.timestamp" local reports = require "kong.reports" local redis = require "resty.redis" -local request_aware_table = require "kong.tools.request_aware_table" +local table_clear = require "table.clear" local kong = kong local pairs = pairs @@ -18,26 +18,23 @@ local EMPTY_UUID = "00000000-0000-0000-0000-000000000000" -- for `conf.sync_rate > 0` local auto_sync_timer -local cur_usage = request_aware_table.new() --- { --- [[ --- [cache_key] = --- ]] --- } +local cur_usage = { + --[[ + [cache_key] = + --]] +} -local cur_usage_expire_at = request_aware_table.new() --- { --- [[ --- [cache_key] = --- ]] --- } +local cur_usage_expire_at = { + --[[ + [cache_key] = + --]] +} -local cur_delta = request_aware_table.new() --- { --- [[ --- [cache_key] = --- ]] --- } +local cur_delta = { + --[[ + [cache_key] = + --]] +} local function is_present(str) @@ -141,9 +138,9 @@ local function get_redis_connection(conf) end local function clear_local_counter() - cur_usage:clear() - cur_usage_expire_at:clear() - cur_delta:clear() + table_clear(cur_usage) + table_clear(cur_usage_expire_at) + table_clear(cur_delta) end local function sync_to_redis(premature, conf)