Closed hyzyla closed 5 years ago
There's nothing specifically in generic-pool that does this. However you might be able to implement something by adding a validate
function to your factory object you supply to createPool
. You might be able to add a "useCount" property to your resources, thats gets incremented when you use it, and then in your validate function you could check that. Otherwise you could add your own check before you return a resource to the pool. This check would look at the count and then release
or destroy
as appropriate.
Thanks, a lot!
Is it possible to destroy resource after acquiring resource N times?