openresty / openresty/lua-nginx-module
ngx.shared.DICT.lpush (and rpush) do not allow expiry time to be set
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 11.8k
- Forks
- 2.1k
- Avg merge
- 6h 1m
- Merged PRs (30d)
- 6
Description
The documentation states that the function signature for ngx.shared.DICT.lpush is as follows:
syntax: length, err = ngx.shared.DICT:lpush(key, value)
It seems that there is no way to set the expiry time of a list which is added to a shared dictionary via lpush and rpush. Other API functions such as ngx.shared.DICT.incr accept an init_ttl argument, which specifies the expiry time of a key initialized by incr.
Since lpush and rpush do not set any expiry time for newly initialized lists, and do not remove unexpired items from memory, if I use lpush or rpush to populate a cache of items which are organized in lists, it seems that once the cache fills up, it will always be full and no new items will be saved until Nginx is restarted.
Am I missing something here?
If not, and if this feature is desired, I would be happy to send a PR adding the feature. (I would just need to know what the API should look like.)
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No source file or test is named. Start by comparing the lpush and rpush APIs with incr's init_ttl behavior, then determine the intended API shape and expiry semantics; the work is done when the requested list expiry behavior is implemented and documented.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c, lua, nginx
- Domain
- api, backend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100