diff mod_firewall/definitions.lib.lua @ 2130:9239893a2400

mod_firewall: Don't use util.cache unless it's needed, and add explanatory error if it is not available
author Matthew Wild <mwild1@gmail.com>
date Fri, 18 Mar 2016 09:57:09 +0000
parents 21bc4d7cddae
children ba42c8882026
line wrap: on
line diff
--- a/mod_firewall/definitions.lib.lua	Fri Mar 18 09:51:01 2016 +0000
+++ b/mod_firewall/definitions.lib.lua	Fri Mar 18 09:57:09 2016 +0000
@@ -33,14 +33,13 @@
 			local burst = tonumber(line:match("%(%s*burst%s+([%d.]+)%s*%)")) or 1;
 			local max_throttles = tonumber(line:match("%(%s*entries%s+([%d]+)%s*%)")) or multirate_cache_size;
 
-			local cache = new_cache(max_throttles, evict_only_unthrottled);
-
 			return {
 				single = function ()
 					return new_throttle(rate*burst, burst);
 				end;
 				
 				multi = function ()
+					local cache = new_cache(max_throttles, evict_only_unthrottled);
 					return {
 						poll_on = function (_, key, amount)
 							assert(key, "no key");