openresty / openresty/lua-nginx-module

time filter for shdict get_keys

Open
#2,305 2 comments 0 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

I have stumbled on a use case where I need to get to most recent items from the shared dict on the get_keys method. For example the ones added in the last 60 seconds. I didn't find a way yet, probably has to be implemented. I think of two ways.

  1. Add a creation_time to the ngx_http_lua_shdict_node_t struct, but I didn't go through all the code to say that this is really needed. This doesn't seem favorable as it increases the memory usage,
  2. add a parameter to get_keys function like ttl_remaining_above? so that this value can be used as a condition while getting the keys (expiry_time - now > param). This seems easier to implement and less taxing.

I think this would be a nice addition, what do you think?

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 by tracing the get_keys implementation and the ngx_http_lua_shdict_node_t struct to understand how shared-dict expiration is represented. Compare the proposed creation_time and remaining-TTL approaches, including their memory and API implications. Done means the desired recent-key behavior and its implementation scope are clearly decided.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
backend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.