Expiring Map

The expiring map is a wrapper around a hash map, where each entry expires some time after being inserted. The intended use is for caching in places where you want to ensure the data does not become stale.

Usage

```rust use expiring_map::ExpiringMap; use std::time::Duration;

let timetolive = Duration::fromsecs(60); let mut map = ExpiringMap::new(timeto_live);

map.insert("keyA".toowned(), "valA".toowned());

asserteq!(Some(&"valA".toowned()), map.get("keyA"));

// after 60 seconds has passed since "keyA" was inserted // map.removeexpiredentries(); ```

Even if map entries have expired, they are not removed from the map until remove_expired_entries is called.

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.