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

Delete expired items before setting #132

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

jaimem88
Copy link

Check if an item exists and it has expired before setting so that
onEvicted is actually called.

Fixes #48.

@jaimem88
Copy link
Author

@patrickmn for your review 🙏

cache.go Outdated Show resolved Hide resolved
Check if an item exists and it has expired before setting so that
onEvicted is actually called.

Fixes patrickmn#48.

Add test and split func

Use nanoseconds instead

Call onEvicted if item existed before setting

Call onEvicted if item.Expired
@ayufan
Copy link

ayufan commented Oct 15, 2020 via email

@ayufan
Copy link

ayufan commented Oct 20, 2020

@patrickmn Would you mind looking at this?

@arp242
Copy link

arp242 commented Oct 22, 2020

Note this is a incompatible change, and some people may be relying on the current behaviour.

Also this library doesn't seem maintained at the moment, so little chance it will get merged. It's better to just maintain your own fork if you need this behaviour.

@ViswanathB
Copy link

Trying to find a cache with TTL that has been rigorously tested and this seems to be a popular choice.
However, looks like repo is not maintained and hasn't been released since 2017.
@koalalorenzo Where you able to find any other forks reliable?

Repository owner deleted a comment from pablodz Jan 8, 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

Successfully merging this pull request may close these issues.

The OnEvicted function is not called if a value is re-set after expiration but before deletion
4 participants