ttl_cache
ttl_cache copied to clipboard
This avoids RUSTSEC-2020-0026 in linked-hash-map for `-Z minimal-versions` builds. https://rustsec.org/advisories/RUSTSEC-2020-0026
How do I prevent actively used TtlCache entry from being expired and run its `Drop::drop`? --- Update: looks like `remove` + `insert` works. Maybe explicit `cache.refresh(&key)` would be more readable?
As per title, `hashlink`: https://crates.io/crates/hashlink I can give it a try in a PR if you want.
As far as I undestand, TtlCache use `std::time::{Duration, Instant}` without any indirection layer. This makes it trickier to [unit-]test the code without waiting. Shall there be some additional testing version...
`let _ = the_cache.iter()` is obvious workaround, but less readable and maintainable. Removing expired elements can be significant if their destructors do something, so that function may be called periodically...
Sometimes just existence is necessary, so a `TtlCacheSet` would be a nice addition.