openresty / openresty/lua-resty-lock
Being able to set an expiration time per key, and not just per dict
Nobody has claimed this yet.
- Dominant language
- Lua
- Stars
- 323
- Forks
- 81
- Avg merge
- 7h 41m
- Merged PRs (30d)
- 2
Description
Currently it's only possible to set an expiration time to the entire dictionary when creating a new instance:
local obj = resty_lock:new("locks_dict", {exptime = 10})
It would be nice to allow setting an expiration time per key too, like:
local obj = resty_lock:new("reports_locks")
obj:lock("test", {exptime = 10})
So that one dictionary can be used to set multiple keys with a different expiration time:
local obj = resty_lock:new("reports_locks")
obj:lock("test", {exptime = 10})
obj:lock("test2", {exptime = 4})
obj:lock("test3", {exptime = 50})
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
Start at the resty_lock:new and obj:lock entry points, then trace how the dictionary-level exptime is applied to shared-memory dictionary entries. Done means the lock API accepts the per-key options shown and allows different expiration values for keys in one dictionary; verify the behavior with the relevant lock tests if present.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- lua
- Domain
- backend, distributed-systems
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100