Skip to content

Instantly share code, notes, and snippets.

@leandromoreira
Created April 19, 2020 19:10
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save leandromoreira/2e6b5c223afe5f24303eaa06d5776dec to your computer and use it in GitHub Desktop.
local wrapper_loadstring = function(str_code)
local api_fun, err = loadstring("return function (edge_computing) " .. str_code .. " end")
if api_fun then return api_fun() else return api_fun, err end
end
-- ... compile cu["code] = wrapper_loadstring(raw_code)
local status, ret = pcall(cu["code"], {redis_client=edge_computing.redis_client})
-- CU in Redis --
-- set authentication "rewrite||local resp, err = edge_computing.redis_client:incr(\"key\") \n ngx.log(ngx.ERR, \" >>>> \", resp) \n"
local resp, err = edge_computing.redis_client:incr("key")
ngx.log(ngx.ERR, " >>>> ", resp)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment