openresty / openresty/lua-nginx-module

Should ngx.shared.DICT.get be able to return a list initialized with ngx.shared.DICT.rpush/lpush?

Open
#2,125 0 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C
Stars
11.8k
Forks
2.1k
Avg merge
6h 1m
Merged PRs (30d)
6

Description

OpenResty version: edge

The documentation for ngx.shared.DICT.get does not state that get is unable to retrieve lists built using ngx.shared.DICT.rpush and lpush. However, any attempt to do this fails with an error. This is the relevant section of implementation code:

https://github.com/openresty/lua-nginx-module/blob/653d6a36f46b077cb902d7ba40824c299cf9bbf4/src/ngx_http_lua_shdict.c#L1672-L1677

I would like to ask: Do the developers of OpenResty consider it undesirable to allow get to retrieve a list from a shared dict? Or did you simply not have time to implement it yet?

If it is a matter of not yet having time to implement this feature, I would be happy to send a PR. (The code would copy the contents of the list into a new Lua table, and return that.)

On the other hand, if the project maintainers do not want this feature, it would be better to update the documentation to be more clear. (I would also be happy to send a PR for that.)

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 src/ngx_http_lua_shdict.c at lines 1672-1677 and compare the documented behavior of ngx.shared.DICT.get, rpush, and lpush. Determine whether list retrieval is intended; completion would require either a scoped implementation with coverage for list values or documentation that explicitly explains the limitation, depending on maintainer direction.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, lua, nginx
Domain
api, backend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.