| Crates.io | fifo-cache |
| lib.rs | fifo-cache |
| version | 0.2.0 |
| created_at | 2025-08-16 00:15:15.532058+00 |
| updated_at | 2025-08-21 16:50:05.007745+00 |
| description | A minimalist FIFO cache with TTL (Time To Live) support |
| homepage | |
| repository | https://framagit.org/dder/fifo-cache |
| max_upload_size | |
| id | 1797638 |
| size | 18,558 |
A minimalist, thread-safe, FIFO (First In, First Out) cache with TTL (Time To Live) support for Rust.
Arc<RwLock<>> (or Arc<Mutex<>>) for concurrent accessAdd this to your Cargo.toml:
[dependencies]
fifo-cache = "0.2"
Or, for no TTL:
[dependencies]
fifo-cache = { version = "0.2", default-features = false }
use fifo_cache::FifoCache;
use std::time::Duration;
let mut cache = FifoCache::new(1000, Duration::from_secs(300));
cache.insert("key", "value");
if let Some(value) = cache.get(&"key") {
println!("Found: {}", value);
}
To run the tests, use the following command:
cargo test
The minimum required Rust version is 1.59. While this is unlikely to change in the foreseeable future, the main objective is to remain at or below Rust 1.77, so as to preserve Windows 7 compatibility.
To test with Rust 1.77:
version = 4 to version = 3 in Cargo.lock.rustup install 1.77.0-x86_64-pc-windows-gnu.cargo +1.77 clippy
cargo +1.77 test
cargo run --example basic_usage