Hi ,
I want to establish connection to say redis once and then subsequently use this handle for get /set requests.
How can I achieve this ?
Should I open connection in init_worker_by_lua and then use it at my location ?
Is the following syntax right ?
init_worker_by_lua '
redis = require "resty.redis"
red = redis:new()
red:set_timeout(100)
local ok, err = red:connect("127.0.0.1", 6379)
...
...
';
location /redis {
content_by_lua '
local res, err = red:get("xyz")
...
...
';
thank you for your time ..
--AshishA