ComputeOnceCachedIDs<D extends Object, V> class

A ComputeOnceCache specialized for batched computations by ID.

Requests with overlapping ID sets share in-flight computations. Results are merged, deduplicated, and returned in the same order as the requested IDs.

Inheritance

Constructors

ComputeOnceCachedIDs({Duration retentionDuration = Duration.zero, ComputeIDCompare<D>? compare, ComputeIDHash<D>? hash})
Creates a cache for batched ID-based computations.

Properties

compare ComputeIDCompare<D>?
Optional comparator used to order IDs and results.
final
hash ComputeIDHash<D>?
Optional hash function used for IDs.
final
hashCode int
The hash code for this object.
no setterinherited
retentionDuration Duration
How long a resolved computation is kept in the cache.
finalinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

calls() Map<ComputeIDs<D>, TimedComputeOnce<List<V>>>
Returns a snapshot of current cached computations.
inherited
clear() → void
Clears the cache and cancels all retention timers.
inherited
computeIDs(List<D> ids, ComputeCallIDs<D, V> call, {PosComputeCall<List<V>>? posCompute, bool resolve = true}) FutureOr<List<(D, V)>>
Computes values for the given ids, reusing and composing the computations returned by getByIDs.
get(ComputeIDs<D> key, ComputeCall<List<V>> call, {PosComputeCall<List<V>>? posCompute, bool resolve = true}) TimedComputeOnce<List<V>>
Returns an existing TimedComputeOnce for key or creates a new one.
inherited
getByIDs(List<D> ids, ComputeCallIDs<D, V> call, {PosComputeCall<List<V>>? posCompute, bool resolve = true}) Map<ComputeIDs<D>, TimedComputeOnce<List<V>>>
Returns computations for the given ids, reusing any overlapping in-flight computations.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
remove(ComputeIDs<D> key) TimedComputeOnce<List<V>>?
Removes a cached computation and cancels any associated timer.
inherited
toString() String
A string representation of this object.
inherited

Operators

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