Show / Hide Table of Contents

Class State<TKey, TValue>

An implementation of IState<TKey, TValue> from a function to query and retrieve an object.

Inheritance
object
StateBase<TKey, TValue>
State<TKey, TValue>
Implements
IState<TKey, TValue>
IReadOnlyCollection<TValue>
IEnumerable<TValue>
IEnumerable
IHasUpdateTime
IDisposable
Inherited Members
StateBase<TKey, TValue>.Logger
StateBase<TKey, TValue>.UpdateTime
StateBase<TKey, TValue>.Count
StateBase<TKey, TValue>.IsUpdateInProgress
StateBase<TKey, TValue>.Cache
StateBase<TKey, TValue>.Semaphore
StateBase<TKey, TValue>.UpdateProcessor
StateBase<TKey, TValue>.Get(TKey, TimeSpan, CancellationToken)
StateBase<TKey, TValue>.Existing(TKey)
StateBase<TKey, TValue>.Clear(TKey)
StateBase<TKey, TValue>.WaitForUpdateFinished()
StateBase<TKey, TValue>.Dispose()
StateBase<TKey, TValue>.GetEnumerator()
StateBase<TKey, TValue>.GetObject(TKey, CancellationToken)
StateBase<TKey, TValue>.Set(in TKey, TValue)
StateBase<TKey, TValue>.AgeObject(TKey)
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: Microsoft.XboxStudios.GameStateTracker
Assembly: GameStateTracker.Core.dll
Syntax
public class State<TKey, TValue> : StateBase<TKey, TValue>, IState<TKey, TValue>, IReadOnlyCollection<TValue>, IEnumerable<TValue>, IEnumerable, IHasUpdateTime, IDisposable where TKey : IEquatable<TKey> where TValue : class
Type Parameters
Name Description
TKey

The key type to query for an object.

TValue

The object type.

Remarks

The query does not need to be thread-safe as it won't be called concurrently.

Constructors

View Source

State(Func<TKey, Task<TValue>>, IObjectCache<TKey, TValue>?, ILogger<State<TKey, TValue>>?)

An implementation of IState<TKey, TValue> from a function to query and retrieve an object.

Declaration
public State(Func<TKey, Task<TValue>> get, IObjectCache<TKey, TValue>? cache = null, ILogger<State<TKey, TValue>>? logger = null)
Parameters
Type Name Description
Func<TKey, Task<TValue>> get

The function to query an object.

IObjectCache<TKey, TValue> cache

The cache to use to store objects.

ILogger<State<TKey, TValue>> logger

The logger to use.

Remarks

The query does not need to be thread-safe as it won't be called concurrently.

Methods

View Source

GetObject(TKey, CancellationToken)

Retrieves an object matching the given query.

Declaration
protected override Task<TValue?> GetObject(TKey query, CancellationToken token)
Parameters
Type Name Description
TKey query

The objects to look for.

CancellationToken token

The cancellation token.

Returns
Type Description
Task<TValue>

An object.

Overrides
StateBase<TKey, TValue>.GetObject(TKey, CancellationToken)

Implements

IState<TKey, TValue>
IReadOnlyCollection<T>
IEnumerable<T>
IEnumerable
IHasUpdateTime
IDisposable

Extension Methods

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