moka-rust
Installation
SKILL.md
Moka Rust
Use these conventions for Rust in-memory caches built with moka-rs/moka.
Source Baseline
- Prefer released docs from
docs.rs/moka, crates.io, and the matching GitHub release over older snippets. - Current docs.rs baseline checked for this skill:
moka 0.12.15. - Moka provides thread-safe, concurrent in-memory caches inspired by Caffeine.
- Current MSRV checked for
syncandfuture: Rust1.71.1. - At least one crate feature,
syncorfuture, must be enabled. - Moka can bound caches by maximum entry count or total weighted size, supports TTL/TTI and per-entry expiration, and supports eviction listeners.
- Moka returns cloned values from cache reads. Store
Arc<T>when values are expensive to clone.
Cargo
Use the synchronous cache for sync code: