Trait \Prado\Collections\TWeakCollectionTrait
This is the common WeakMap caching implementation for Weak Collections. It constructs a WeakMap, where available, and tracks the number of times an object is \Prado\Collections\weakAdd to and \Prado\Collections\weakRemove from the Collection.
When the PHP environment invalidates a WeakReference, it is no longer linked in the WeakMap. The number of known objects is tracked and upon deviations in the WeakMap count then weakChanged becomes true. When weakChanged is true the implementing class can scrub the list of invalidated WeakReference.
There are utility functions for managing the WeakMap to \Prado\Collections\weakStart, \Prado\Collections\weakRestart, \Prado\Collections\weakClone, and \Prado\Collections\weakStop the WeakMap. The total number of objects in the WeakMap can be retrieved with weakCount and the count of each object with weakObjectCount.
Trait hierarchy
Author: Brad Anderson <belisoful@icloud.com>Since: 4.3.0
protected
|
|
protected
|
|
protected
|
|
protected
|
|
protected
|
|
protected
|
|
protected
|
|
protected
|
weakResetCount() : void
Resets the new number of known objects in the list to the current WeakMap count.
|
protected
|
|
protected
|
|
protected
|
|