Skip to main content

Module cache

Module cache 

Source
Expand description

TTL-based caching.

This module provides a thread-safe, capacity-bounded cache with time-to-live (TTL) expiration.

§Clock

The cache uses tokio::time::Instant as its monotonic clock. In normal operation this is identical to std::time::Instant; when a test runs inside a #[tokio::test(start_paused = true)] runtime, the clock becomes virtual and can be advanced deterministically via tokio::time::advance, which keeps TTL unit tests fast and non-flaky.

Structs§

TtlCache
Thread-safe TTL cache.