Closed Amedeo91 closed 2 months ago
Thanks for your interest, but instead of a callback-based solution introducing another constructor argument, I opted for expire()
returning the expired items, which can be examined by a subclass overriding this method. This is more in line with the existing popitem()
documentation.
However, thanks again for submitting this, since it finally made me actually sit down and do something about this issue ;-)
Hello there, that knyou for having a look. Did you merge already your implementation? I am curious to see it! Thanks
Not yet, please see https://github.com/tkem/cachetools/tree/dev/v5.5.0 and feel free to comment.
Hello there, the goal of this PR is to provide a callback to process expired cached objects, such as connection to databases or similar, which needs to be closed to avoid memory leaks. That would be the only way without the need to override the expire function. Notice that: it could make sense to extend that to delitem or pop method, however, those can be easily overridden without the need to copy-paste the whole implementation. Thanks