janestreet / janestreet/resource_cache
[feature request] semi-permanent resource
- Dominant language
- OCaml
- Stars
- 5
- Forks
- 2
- PR merge metrics
- No merged PRs in 30d
Description
Thanks for your great work, resource_cache is a very useful library.
Currently, there is a feature that I'm looking forward to.
For example, when the resources are connections to a database, I'd like to keep the connections permanent if they are not idle, instead of closing them after max_resource_reuse is reduced to zero, so there won't be too much connecting disconnecting(which is expensive).
So, is there any chance to redefine the
`max_resource_reuse` field in `Resource_cache.Config.t`,
as
`type max_resource_reuse= Unlimited | Reuse of int`
?
So we can alter the behavior of resource_cache more handily.
Contributor guide
Research direction
Start by reading Resource_cache.Config.t and the current max_resource_reuse handling. Trace how reuse limits affect idle and active resources; done means supporting Unlimited alongside Reuse of int while preserving existing finite-reuse behavior and preventing non-idle resources from being closed solely because the limit reaches zero.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ocaml
- Domain
- backend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100