TtlCache<K extends Object, V extends Object> constructor
Creates a cache whose entries each expire ttl after being stored. now
supplies the current time for stamping and checking expiry; it defaults to
DateTime.now and can be overridden in tests to advance a virtual clock.
Audited: 2026-06-12 11:26 EDT
Implementation
TtlCache(Duration ttl, {DateTime Function()? now}) : _ttl = ttl, _now = now ?? DateTime.now;