LazyWeakReferenceManager<T extends Object> class
Controls automatic weakening of strong references held by LazyWeakReference instances.
The manager temporarily keeps objects strongly reachable and later downgrades them to weak references after a configurable delay. This effectively behaves like a time-based generational cache, preserving recently used objects while allowing older ones to be garbage-collected.
Constructors
- LazyWeakReferenceManager({Duration weakenDelay = defaultWeakenDelay, int batchLimit = defaultBatchLimit, Duration batchInterval = defaultBatchInterval})
Properties
- batchInterval → Duration
-
Delay between batch processing. Default: 1 ms
final
- batchLimit → int
-
Maximum references processed per batch. Default: 100
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- unixTimeMs → int
-
Current unix time in milliseconds.
no setter
- weakenDelay → Duration
-
Time before a strong reference becomes weak. Default: 1 sec
final
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
strong(
T target) → LazyWeakReference< T> - Creates a managed strong reference.
-
toString(
) → String -
A string representation of this object.
inherited
-
weak(
T target) → LazyWeakReference< T> - Creates a managed weak reference.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Constants
- defaultBatchInterval → const Duration
- defaultBatchLimit → const int
- defaultWeakenDelay → const Duration