Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TTL Deletion Hook #103

Closed
four43 opened this issue Jun 19, 2018 · 3 comments
Closed

TTL Deletion Hook #103

four43 opened this issue Jun 19, 2018 · 3 comments

Comments

@four43
Copy link

four43 commented Jun 19, 2018

I need to hook into when a cache item is removed from a TTLCache. It seems that expire() doesn't call it's local __delitem__() or the popitem() methods when an item is removed via expiration. Are you interested in a pull request for this feature?

@tkem
Copy link
Owner

tkem commented Jun 19, 2018

popitem() is only called when items are removed when a cache is full to make room for new items. Items whose TTL expires just vanish into thin air, because you told them to do so after a certain time ;-)
Unless this is a popular use case I just haven't heard about so far, I'd prefer to not add any special handling for this.

@four43
Copy link
Author

four43 commented Jun 19, 2018

I was using this to managed locally cached files. I needed a hook to for when an item is deleted from the cache so I can remove them from my temporary directory. This library was too inflexible and I ended up just writing my own.

@four43 four43 closed this as completed Jun 19, 2018
@momocow
Copy link

momocow commented Mar 23, 2020

I met the same requirements, cached files, and came up with this library in mind. But it seems that I should implement my own cache to play with cached files.

tkem added a commit that referenced this issue Aug 18, 2024
tkem added a commit that referenced this issue Aug 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants