Expand description
ExpiringMap
is a wrapper around HashMap
that allows the specification
of TTLs on entries. It does not support iteration.
use std::time::Duration;
use expiringmap::ExpiringMap;
let mut map = ExpiringMap::new();
map.insert("key", "value", Duration::from_millis(50));
std::thread::sleep(Duration::from_millis(60));
assert!(map.get(&"key").is_none());
Structsยง
- Expiring
Map - A wrapper around
HashMap
which adds TTLs - Expiring
Set - A set version of
ExpiringMap
. SetsV
to()
- Expiry
Value - A struct to contain a value and its expiry information