ExpiringCollectionTItem Class |
Namespace: VirtualRadar.Interface
The ExpiringCollectionTItem type exposes the following members.
Name | Description | |
---|---|---|
ExpiringCollectionTItem |
Creates a new object.
|
Name | Description | |
---|---|---|
AfterCheckForExpiredItemsDelegate |
Gets or sets an optional delegate that is called after the check for expired items is made.
| |
BeforeCheckForExpiredItemsDelegate |
Gets or sets an optional delegate that is called before the check is made for expired items.
| |
Count |
When overridden by the derivee this returns the current count of items in the collection.
| |
CountChangedDelegate |
Gets or sets an optional delegate that is called when the count changes. The new count is
passed to the delegate. The list is locked to the calling thread while the delegate is running.
The delegate will occasionally be called on a background thread.
| |
ExpireMilliseconds |
Gets or sets the minimum number of milliseconds that an item can remain within the list.
| |
MillisecondsBetweenChecks |
Gets or sets the minimum number of milliseconds to wait between checks for expiring items.
|
Name | Description | |
---|---|---|
ChangeIntervals |
Changes the intervals for the expiration of items and the interval between checks.
| |
Clear |
When overridden by a derivee this clears the collection and unhooks all events.
| |
Dispose |
See interface docs.
| |
Dispose(Boolean) |
Disposes of or finalises the object.
| |
DoRemoveExpiredItems |
When overridden by the derivee this should remove all items that have a timestamp that is less than or
equal to the threshold passed across.
| |
Equals | (Inherited from Object.) | |
Finalize |
Finalises the object.
(Overrides ObjectFinalize.) | |
GetHashCode | Serves as a hash function for a particular type. (Inherited from Object.) | |
GetType | Gets the Type of the current instance. (Inherited from Object.) | |
HookHeartbeat |
Hooks the heartbeat event. Must be called from within a lock.
| |
Lock |
Calls the action passed across with the list locked. Do not perform an action that will attempt
to lock the list from another thread, it will block.
| |
MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) | |
OnCountChanged |
Called by the derivee to inform the owner of the collection that the count has changed. Always call this
from within a lock.
| |
RemoveExpiredItems |
Removes expired items.
| |
ToString | Returns a string that represents the current object. (Inherited from Object.) | |
UnhookHeartbeat |
Unhooks the heartbeat service if hooked. Must be called from within a lock.
|
Name | Description | |
---|---|---|
_Clock |
The clock that provides timestamps.
| |
_SyncLock |
The lock object that controls access to the other fields.
|
When an item is added to this collection it is given a timestamp. The items in the collection are periodically checked, if they have been in the collection for longer than ExpireMilliseconds then they are removed.
This class is disposable. However, Dispose() just clears the collection. Clearing the collection releases all hooks, so it is kind-of permissible to not dispose of these objects - once the last item in the collection expires the class will automatically unhook itself and become eligible for finalising (if there are no strong references to it). However it is better if you can dispose of it when you are finished with it.