lua-resty-redis
lua-resty-redis copied to clipboard
init_worker_by_lua + redis - how?
trafficstars
Hi there,
Is there any "legal" way to connect to redis from a worker created via the new init_worker_by_lua* directives?
Anything I try gives me the "API disabled in the context of init_worker_by_lua*" error.
@kikito You cannot directly use cosockets in the context of init_worker_by_lua but you can use them in a timer created by init_worker_by_lua. See
https://github.com/chaoslawful/lua-nginx-module#ngxtimerat
The lua-resty-upstream-healthcheck library uses this trick.