MemoizeWithTTL<R> class

Creates a memoized function that returns cached values while refreshing in parallel (write-through cache pattern).

  • If cache is fresh, return immediately.
  • If cache is stale, return the stale value but refresh in the background.
  • If no cache exists, block and compute the value.

Constructors

MemoizeWithTTL(R _fn(List args), {Duration cacheLifetime = const Duration(minutes: 5), String keyFn(List args)?})

Properties

cacheLifetime Duration
final
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

call(List args) → R
clear() → void
Clear the cache.
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