public int ThresholdCapacity { get; set; }
Public Property ThresholdCapacity As Integer
Get
Set
public:
property int ThresholdCapacity {
int get ();
void set (int value);
}
member ThresholdCapacity : int with get, set
The value of the ThresholdCapacity property must be greater than or equal to the value of the InitialCapacity property.
When the first element is about to be stored a dynamic storage is allocated that can optimally store about as many elements as specified by the InitialCapacity property. When the number of stored elements reaches InitialCapacity capacity, then the content of the dynamic storage is copied into a faster read-only storage, and for additional elements a new dynamic storage is allocated with either doubled capacity or the specified ThresholdCapacity, whichever is less.
Once the number of stored elements in the dynamically growing storage reaches ThresholdCapacity, the complete previous content of the faster read-only storage is replaced by the elements in the growing storage. Therefore, when adding new items continuously, the number of stored elements will be between ThresholdCapacity and twice of ThresholdCapacity.
If it cannot be really estimated how many items in the cache will be stored, then you can set the MergeInterval property, which can trigger a merge operation to the faster storage by time, regardless of reaching the required capacity limit.