Registry / utility / stretto

stretto

JSON →
library0.9.0rscratesunverified

A high performance thread-safe memory-bound Rust cache.

# Cargo.toml [dependencies] stretto = "0.9.0"
INSTALL
IMPORT
SIG · STRETTO
S
stretto
utilityrustv0.9.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Cache
use stretto::Cache;

Creates a cache with max capacity 1000 entries and 1MB cost, inserts a key-value pair, and retrieves it.

use stretto::Cache; fn main() { let cache: Cache<String, String> = Cache::new(1000, 1_000_000).unwrap(); cache.insert("key".to_string(), "value".to_string(), 1).unwrap(); let val = cache.get(&"key".to_string()); println!("{:?}", val); }
Debug
Known issues
gotchaRequires async runtime for background eviction tasks
fix
Run the cache's background task with `cache.run_pending_work()` or spawn it in a tokio task.
affects: >=0.9.0
Upgrade
Version history
0.9.0latest on crates.io
Audit
Dependencies

No dependency data recorded yet.

Agent activity
5 hits · last 30 days
node
4
Resources
stretto — cargo add stretto · libregistry