Show / Hide Table of Contents

Interface IState<TKey, TValue>

Represents a state of a collection of objects with the capability to update when out-of-date.

Inherited Members
IReadOnlyCollection<TValue>.Count
IEnumerable<TValue>.GetEnumerator()
IHasUpdateTime.UpdateTime
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 Source

Clear(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.

View Source

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.

View Source

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.

Extension Methods

IEnumerableExtensions.WithoutLast<T>(IEnumerable<T>)
  • View Source
In this article
Back to top Generated by DocFX