Interface IState<TKey, TValue>
Represents a state of a collection of objects with the capability to update when out-of-date.
Inherited Members
Namespace: Microsoft.XboxStudios.GameStateTracker
Assembly: GameStateTracker.Abstractions.dll
Syntax
public interface IState<TKey, TValue> : IReadOnlyCollection<TValue>, IEnumerable<TValue>, IEnumerable, IHasUpdateTime where TValue : class
Type Parameters
Name | Description |
---|---|
TKey | The key type to query for an object. |
TValue | The object type. |
Methods
View SourceClear(TKey)
Removes an object from the cache.
Declaration
bool Clear(TKey info)
Parameters
Type | Name | Description |
---|---|---|
TKey | info | The object info. |
Returns
Type | Description |
---|---|
bool | True if the object was removed. |
Existing(TKey)
Gets a cached object with the given info.
Declaration
TValue? Existing(TKey info)
Parameters
Type | Name | Description |
---|---|---|
TKey | info | The object info. |
Returns
Type | Description |
---|---|
TValue | The object. |
Get(TKey, TimeSpan, CancellationToken)
Retrieves an object.
Declaration
Task<TValue?> Get(TKey query, TimeSpan maxAge, CancellationToken token = default)
Parameters
Type | Name | Description |
---|---|---|
TKey | query | The object to look for. |
TimeSpan | maxAge | The maximum age of the object, if it exists in the cache. |
CancellationToken | token | The cancellation token. |
Returns
Type | Description |
---|---|
Task<TValue> | The object. |