Skip to content

Commit

Permalink
Requiring resty.lrucache only if lrucache has been enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
subnetmarco committed Jul 14, 2015
1 parent 47a1d73 commit 2c3adb0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/resty/iputils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ local byte = string.byte
local str_find = string.find
local str_sub = string.sub

local resty_lrucache = require "resty.lrucache"
local lrucache = nil

local _M = {
Expand All @@ -36,6 +35,7 @@ end


local function enable_lrucache(size)
local resty_lrucache = require "resty.lrucache"
local size = size or 4000 -- Cache the last 4000 IPs (~1MB memory) by default
local lrucache_obj, err = resty_lrucache.new(4000)
if not lrucache_obj then
Expand Down

0 comments on commit 2c3adb0

Please sign in to comment.