Expand description
Adapter exposing a TimeProvider as a [moka::ExternalClock].
By default a moka cache measures its TTL/TTI/expiry against wall-clock
std::time::Instant, which ignores our pluggable TimeProvider — so under a
ScaledTimeProvider (integration tests run time fast) cache eviction would
fire on real time, out of step with the rest of the system. Building a cache
with .external_clock(Arc::new(TimeProviderMokaClock::new(time_provider)))
routes all of moka’s time decisions through that provider instead, so the
same code behaves correctly under both real and scaled clocks.
Relies on the ExternalClock seam added to our vendored moka fork
(see 3rdparty/moka/PATCH_NOTES.md).
Structs§
- Time
Provider Moka Clock - Bridges a
TimeProviderto [moka::ExternalClock]. moka tracks time as aDurationelapsed since the clock’s origin, so we capture the provider’s reading at construction and report the difference on each call.