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

[enhancement] support for loader function #31

Closed
ekovacs opened this issue Jul 23, 2020 · 2 comments
Closed

[enhancement] support for loader function #31

ekovacs opened this issue Jul 23, 2020 · 2 comments

Comments

@ekovacs
Copy link

ekovacs commented Jul 23, 2020

it would be awesome, if ttlcache could be given a loader function.
Upon a cache miss (key not present in the cache), the cache would call this loader func, and create/load the value for the key, and would put it in the cache with the default global expiration.

@ReneKroon
Copy link
Contributor

I'm planning a little work for a v2, consequently this would mean i can solve #29 by having an error return value on all public calls. It would then also be 'free' to add a SetLoader function as it can transparently relay any errors. I guess this will be done somewhere in the next 4 weeks.

@ReneKroon
Copy link
Contributor

Hi, @ekovacs are you able to check how the changes on the V2 branch would work for you?

@ReneKroon ReneKroon mentioned this issue Jul 28, 2020
Merged
ReneKroon pushed a commit that referenced this issue Jul 28, 2020
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

2 participants