lookup method
Looks up a cached outcome. Returns null if not present, expired, or disabled. Evicts expired entries on read.
Implementation
MissionOutcome? lookup(MissionKey key) {
if (!enabled || ttl == Duration.zero) return null;
final now = DateTime.now();
final cached = _entries[key];
if (cached == null) return null;
if (now.isAfter(cached.expiresAt)) {
_entries.remove(key);
return null;
}
// Refresh insertion order for LRU.
_entries.remove(key);
_entries[key] = cached;
return OutcomeCachedServed(cached.outcome);
}