Crates.io | expiringmap |
lib.rs | expiringmap |
version | 0.1.2 |
source | src |
created_at | 2024-04-14 17:06:25.06946 |
updated_at | 2024-08-13 22:35:16.272059 |
description | a HashMap-backed TTL map |
homepage | |
repository | https://github.com/randomairborne/expiringmap |
max_upload_size | |
id | 1208386 |
size | 14,203 |
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());
}