Memoized1<V, A1> class
Represents a memoization wrapper for a computation that takes one argument
and returns a value of type V
.
This class uses an LRU (Least Recently Used) cache to store results of the computations based on the arguments passed. The cache has a default capacity(128) but can be configured via the constructor.
This is particularly useful for functions where the computation is expensive and you don't want to recompute the value for the same argument multiple times.
Constructors
- Memoized1.new(V body(A1), {int capacity = 128})
Properties
- 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(
A1 arg) → V -
Calls the wrapped computation with
arg
and returns the cached value. -
expire(
A1 arg) → void -
Removes the cached value associated with the given
arg
. -
expireAll(
) → void - Clears the entire cache, removing all cached values.
-
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