jaemk / cached

Rust cache structures and easy function memoization
MIT License
1.58k stars 95 forks source link

Add ExpiringValueCache for values that impl CanExpire. #118

Closed absoludity closed 2 years ago

absoludity commented 2 years ago

Signed-off-by: Michael Nelson minelson@vmware.com

As outlined in #115 this PR implements a cache for values that know themselves when they expire.

Note: I wasn't sure if there was a set preference for copyright/license addition in new source files, so have added 2 lines according to VMware's preference, but we always go with the existing preference of the project, so if that's not to include those two lines, let me know and I'll remove them.

Or if there are any other improvements or changes required, just let me know.

Thanks! Looking forward to removing the extra code in our Kubeapps project (https://github.com/vmware-tanzu/kubeapps/issues/4934)

jaemk commented 2 years ago

Nice, thanks!

For copyright, can you add a top-level COPYRIGHT file with the following?

Copyrights in the "cached" project are retained by their contributors. No
copyright assignment is required to contribute to the "cached" project.

Copyright attributions may be noted at the top of individual files.
For full authorship information, see the version control history.
https://github.com/jaemk/cached/graphs/contributors

I'd prefer if those 2 lines were removed so others don't need to worry about updating notices, but if the attribution of vmware on your behalf needs to be explicit, then I think those 2 lines are ok to keep. I haven't had to think about explicit copyright notices before so let me know if this doesn't make sense!

absoludity commented 2 years ago

Nice, thanks!

For copyright, can you add a top-level COPYRIGHT file with the following?

Done.

[snip]

I'd prefer if those 2 lines were removed so others don't need to worry about updating notices,

That's fine - removed. They aren't required, just the preferred, but the policy is to go with the repository preference :)

Let me know if there are any other changes needed.

jaemk commented 2 years ago

Thanks! Released in 0.35.0!

absoludity commented 2 years ago

Excellent, thanks!