Skip to content

Commit b8c8724

Browse files
authored
put redis instance in function
1 parent 075bfe9 commit b8c8724

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lua_ad/libs/redis.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
local redis = require "resty.iredis"
22

3-
local red = redis:new({["ip"]="10.0.61.51", ["port"]=6379})
4-
53
local _M = {}
64

75
function _M.get_from_redis(key)
6+
local red = redis:new({["ip"]="10.0.61.51", ["port"]=6379})
87
local res, err = red:get(key)
98
if res then
109
return res
@@ -14,6 +13,7 @@ function _M.get_from_redis(key)
1413
end
1514

1615
function _M.mget_from_redis(args)
16+
local red = redis:new({["ip"]="10.0.61.51", ["port"]=6379})
1717
local res, err = red:mget(unpack(args))
1818
if res then
1919
return res

0 commit comments

Comments
 (0)