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
Allow access to the entry (and its expiration) via get() #8
Conversation
Ping if you're around. Been using this version for the last few months and it's been working well. |
Adds an `entry()` accessor, which operates in parallel to the existing `deref()` access to the underlying value.
In order to unblock publishing other packages to crates.io that use this patch, I've created a |
@nickbp what exactly is the use case behind accessing the entry itself? Edit: nvm I saw the attached issue. Let me think about it a little and I'll get back to you after I try a few things out. Your changes work but I feel there may be a better option. |
Example usage in a DNS server here: https://git.sr.ht/~nickbp/originz/tree/main/item/src/cache/memory.rs#L53 If the entry is present, its remaining TTL in the cache is included in the DNS response |
Okay @nickbp, played around with it a bit... I think it is a mistake that What do you think about this approach? |
Sounds good to me! |
@nickbp after playing around with the various options, I have decided to mask I stripped In a couple of places I use this crate, the usage actually cleaned up a little bit with these changes. Hopefully you can test and notice the same, while also getting access to the expiration values you needed. Please let me know if everything looks good, then I can merge and push it up! I still have a few things I'm looking at for making it smoother, but I don't expect the public API to change much (or at all). |
I have published the changes in |
This works great, thanks a ton! |
Adds an
entry()
accessor, which operates in parallel to the existingderef()
access to the underlying value.(Resolves #6)