Repository navigation
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
flush_expired(max_count)can scan the entire shared dictionary while holding its mutex when expired entries are sparse. Its release limit does not limit the number of entries inspected.Add
ngx.shared.DICT:flush_expired_tail(max_count)for opportunistic cleanup starting at the least recently used end of the LRU queue. It skips entries without an expiration and stops at the first entry with an expiration time in the future, the required positive integer release limit, or the end of the queue. It reuses the existing reclamation code, including list-member cleanup, and leavesflush_expired()semantics unchanged.The API does not guarantee eventual reclamation of expired entries behind an entry with an expiration time in the future. The limit bounds freed entries, not inspected entries or elapsed time: skipping non-expiring entries can still require a full scan, and freeing a list releases all its members under the dictionary lock. These limits and the need for a separate cleanup mechanism when eventual reclamation is required are documented.
Validation:
t/195-shdict-flush-expired-tail.t,t/043-shdict.t,t/145-shdict-list.t, andt/144-shdict-incr-init.t.git diff --checkpasses. No production latency improvement is claimed from these functional tests.I hereby granted the copyright of the changes in this pull request
to the authors of this lua-nginx-module project.