-
-
Notifications
You must be signed in to change notification settings - Fork 6
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
Support a maximum age for cache entries #111
Comments
Thank you for this suggestion. This seems to be a good feature proposal for v2.1 or v2.2. I think we need to focus more on getting v2.0 polished with the current feature set but surely, let's keep this issue open. |
@sschuberth Meanwhile, as a workaround for this limitation, you can use the filesystem's "last modified date" or "created date" as it is more efficient than you're current approach. It is possible as Kache gives you direct access to the file rather than an |
From the Kache v2.1.0-beta01 release notes:
Wohoo, thanks for implementing this! I plan to give this a try soon! |
@sschuberth Thank you for staying interested in this library. I'm looking forward to your feedback to prepare the first stable release of the library after revamping the documentation and testing it more. I am afraid that this feature is currently limited to the in-memory cache not the persistent cache which is the equivalent for DiskLruCache that you mentioned here. Adding it to the persistent cache would likely mean refactoring the current implementation of it in the in-memory cache though I expect it to be binary compatible with the current version, so no worries. For the implementation details:
|
Thanks for pointing that out, I indeed initially missed that.
Thanks, but I'm probably too far away from the code base to give meaningful advice. |
Some cache entities should not be cached forever but expire after a certain amount of time, e.g. to force doing an expensive network request to fetch the original data to ensure it's still valid. For this, I'd propose to add e.g. a
var maxAge: Long
property toConfiguration
.FYI, in our DiskLru wrapper we implemented this like so:
https://github.com/oss-review-toolkit/ort/blob/e484f98f6375d78ce6f7934edf9728863c36ed40/utils/common/src/main/kotlin/DiskCache.kt#L115-L123
The text was updated successfully, but these errors were encountered: