You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on May 21, 2022. It is now read-only.
Thank you for your suggestion. I think that what you ask could be implemented in two different ways:
Create a timer which periodically removes objects that do not match a specified filter (in your case, time itself is the filter).
Do not let in/out of the pool all objects which do not match a specified filter (as before, time would be your filter).
Solution 1 is the only one which would ensure consistent "freshness" of objects contained in the pool. However, this would imply adding an additional thread whose job is cleaning up the pool, and, well, I do not really like the idea of shipping a lib which executes "hidden" work on separate threads. Thus, it will not be implemented, I'm sorry.
Solution 2 works perfectly when the pool is frequently used, because:
When an object is going out of the pool, it might get discarded if it does not respect the filter. It would not be returned to the user and removed from the pool.
When an object is returning to the pool, it might get discarded if it does not respect the filter.
However, if the pool is not used at all, objects not respecting the filter would stay in pool anyway. In any case, when one chooses to use an object pool, the number of pool usages is expected to be very high, so we should not have an issue there. In order to implement solution 2, we need a filter for items going out of the pool (not implemented as of now), and one for items going in (already available and actually used for specialized pools).
If solution 2 is OK for you, then I will start implementing it as soon as possible.
Hi! First, thanks for your lib!
I'd like to make a suggestion: where can we implement a timeout feature in order to release an unused
PooledObject
from the pool?It should be nice to have a constructor like:
What do you think?
The text was updated successfully, but these errors were encountered: