diff options
author | Kim Alvefur <zash@zash.se> | 2015-11-25 20:49:41 +0100 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2015-11-25 20:49:41 +0100 |
commit | dd9e60beba3cdea9b29aff668a4af411f03918b9 (patch) | |
tree | 7959e98690bcf2fb80047b1145a5c94ca29167a9 /util | |
parent | c8454e918047a5de57dcdaeb3ffe94e43bb9bb9b (diff) | |
download | prosody-dd9e60beba3cdea9b29aff668a4af411f03918b9.tar.gz prosody-dd9e60beba3cdea9b29aff668a4af411f03918b9.zip |
util.cache: Make sure cache size is specified as an integer
Diffstat (limited to 'util')
-rw-r--r-- | util/cache.lua | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/util/cache.lua b/util/cache.lua index 9453697c..32670751 100644 --- a/util/cache.lua +++ b/util/cache.lua @@ -2,6 +2,8 @@ local cache_methods = {}; local cache_mt = { __index = cache_methods }; local function new(size) + size = assert(tonumber(size), "cache size must be a number"); + size = math.floor(size); assert(size > 0, "cache size must be greater than zero"); local data = {}; return setmetatable({ data = data, count = 0, size = size, head = nil, tail = nil }, cache_mt); |