Class TimeElapsedHelper<TKey>
A helper class used to associate objects with a System.DateTime value and to compare against the current time.
Inheritance
Inherited Members
Namespace: Phoenix.PackageManagement
Assembly: Phoenix.Core.dll
Syntax
public class TimeElapsedHelper<TKey>
Type Parameters
Name | Description |
---|---|
TKey | The object type. |
Properties
View SourceKeys
Gets a collections of the objects with an existing refresh time.
Declaration
public ICollection<TKey> Keys { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.ICollection<TKey> |
Methods
View SourceIsOlderThan(TKey, TimeSpan, Nullable<DateTime>)
Compares the time elapsed since the object's start time to a value.
Declaration
public bool IsOlderThan(TKey item, TimeSpan maxAge, DateTime? now = null)
Parameters
Type | Name | Description |
---|---|---|
TKey | item | The object. |
System.TimeSpan | maxAge | The value to compare against. |
System.Nullable<System.DateTime> | now | The current time to use. |
Returns
Type | Description |
---|---|
System.Boolean | True if the object's start time is greater than the value to compare against. |
Refresh(TKey)
Sets the object's start time to the current time.
Declaration
public void Refresh(TKey item)
Parameters
Type | Name | Description |
---|---|---|
TKey | item | The object. |
Remove(TKey)
Removes an object's start time.
Declaration
public void Remove(TKey item)
Parameters
Type | Name | Description |
---|---|---|
TKey | item | The object. |
Set(TKey, DateTime)
Sets the object's start time.
Declaration
public void Set(TKey item, DateTime value)
Parameters
Type | Name | Description |
---|---|---|
TKey | item | The object. |
System.DateTime | value | The start time. |
TryGet(TKey)
Gets the time elapsed since an object's start time.
Declaration
public TimeSpan? TryGet(TKey item)
Parameters
Type | Name | Description |
---|---|---|
TKey | item | The object. |
Returns
Type | Description |
---|---|
System.Nullable<System.TimeSpan> | The time elapsed since the object's start time. |
TryGet(TKey, DateTime)
Gets the time elapsed since an object's start time.
Declaration
public TimeSpan? TryGet(TKey item, DateTime now)
Parameters
Type | Name | Description |
---|---|---|
TKey | item | The object. |
System.DateTime | now | The current time to use. |
Returns
Type | Description |
---|---|
System.Nullable<System.TimeSpan> | The time elapsed since the object's start time. |