Pool<T extends Pooled> class
An object pool that can allow reuse of objects. A pooled object must add the mixin Pooled to work with this pool. You can define the minAvailable and growthFactor to control the pool size. The growthFactor is a multiplier on the inUse count. So if 100 are in use with a growth factor of 0.15, the pool will maintain 15 available objects.
By default batchedGrowth is enabled which means that the pool will only grow when there are no available objects. If you disable this, the pool will grow every time you take an object, essentially double allocating whenever a new object is needed on top of the existing inUse objects. Batched growth is better for GC however if you need low latency and can afford the added new-pressure you can disable it.
Constructors
Properties
- availableCount → int
-
Gets the count of objects currently available
no setter
- batchedGrowth → bool
-
final
- factory → T Function()
-
final
- growthFactor → double
-
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- inUseCount → int
-
Gets the count of objects in use
no setter
- minAvailable → int
-
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- shrinkFactor → double
-
final
- take → T
-
Grows the pool availability if needed then takes an available object from the pool
no setter
- takeNow → T
-
Takes from the available set of objects without attempting to grow, will throw
an exception if no objects are available instead of growing.
no setter
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
release(
T t) → void -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited