expiringmap

Crates.ioexpiringmap
lib.rsexpiringmap
version0.1.2
sourcesrc
created_at2024-04-14 17:06:25.06946
updated_at2024-08-13 22:35:16.272059
descriptiona HashMap-backed TTL map
homepage
repositoryhttps://github.com/randomairborne/expiringmap
max_upload_size
id1208386
size14,203
valkyrie_pilot (randomairborne)

documentation

README

expiringmap

A rust library implementing a TTL map.

use std::time::Duration;
use expiringmap::ExpiringMap;

fn main() {
    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());
}
Commit count: 13

cargo fmt