IdempotencyCache class

A TTL-bounded idempotency cache (FR-007).

Re-submitting a completed mission key within the configured TTL returns the cached outcome wrapped in OutcomeCachedServed. After TTL expiry, the entry is evicted and the next submission executes fresh.

The cache is bounded by maxEntries; the oldest entry (by insertion order) is evicted when full.

Constructors

IdempotencyCache({Duration ttl = const Duration(minutes: 5), int maxEntries = 256, bool enabled = true})

Properties

enabled bool
Whether idempotency is enabled. When false, lookup always returns null.
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
maxEntries int
Maximum entries before LRU eviction.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
size int
Number of live entries (excluding expired).
no setter
ttl Duration
TTL for cached outcomes. Zero disables the cache (every submission runs fresh).
getter/setter pair

Methods

clear() → void
Clears all entries.
lookup(MissionKey key) MissionOutcome?
Looks up a cached outcome. Returns null if not present, expired, or disabled. Evicts expired entries on read.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
store(MissionKey key, MissionOutcome outcome) → void
Stores outcome for key with TTL starting at now.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited