openresty / openresty/lua-resty-redis

no request found

Open
#272 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Lua
Stars
2k
Forks
447
Avg merge
2h 24m
Merged PRs (30d)
3

Description

This code being executed from the context of init_by_lua_file is giving the below error:

local red = redis:new()

Looking at this - https://github.com/openresty/lua-resty-redis#limitations

It says:

This library cannot be used in code contexts like init_by_lua*, set_by_lua*, 
log_by_lua*, and header_filter_by_lua* where the ngx_lua cosocket API is not available.

I want to execute a lua script when the nginx server starts. And usually that's done through init_by_lua_block/init_by_lua_file directives. How can I achieve that purpose here?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the init_by_lua_file and init_by_lua_block entry points and the lua-resty-redis limitations referenced in the issue. Determine whether the requested startup-time Redis access is supported and document a viable project-compatible approach; the issue is done when that approach is clearly established.

Written by the indexing model from the issue text.

Assessment

Tech stack
lua, nginx, redis
Domain
backend, databases
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.