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

Distinguish ttl removed items from manually deleted items #330

Open
Tipwheal opened this issue Feb 28, 2024 · 0 comments
Open

Distinguish ttl removed items from manually deleted items #330

Tipwheal opened this issue Feb 28, 2024 · 0 comments

Comments

@Tipwheal
Copy link

Tipwheal commented Feb 28, 2024

Hello, I found that there're dispose and disposeAfter options in constructor.

In my case, I want to distinguish these two behaviors:

  • items deleted because of ttl settings (with ttlAutoPurge)
  • items deleted manually (by calling cache.delete)
    in order to destroy something like File handles to prevent memory leaks.

When an item is manually deleted by the user, I just turn the control to the user to decide when to destroy. But when the item is evicted beaucse of max size settings or ttl settings, I need to automatically destroy them in dispose or disposeAfter hooks. And I found that in both ttl deleted case and manually deleted case, the reasons are delete. So I found it hard to implement my logics.

Is there any solution to this?

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

1 participant