RefreshAhead class final

Refresh-ahead: after refreshAfter has elapsed since the last read, the next get triggers a background refresh while still returning the current (potentially stale) value. The cache is never cold.

Useful for high-read, low-staleness-tolerance data (e.g., product prices).

Inheritance

Constructors

RefreshAhead({required Duration refreshAfter, Duration? ttl})
const

Properties

hashCode int
The hash code for this object.
no setterinherited
refreshAfter Duration
How long after the last access before a background refresh is triggered.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
ttl Duration?
Hard TTL — the entry is evicted if a background refresh hasn't completed by this deadline. Prevents infinitely stale data.
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

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