Show / Hide Table of Contents

Class ClassObjectCacheBase<TKey, TValue>

An abstract base class for implementing IClassObjectCache<TKey, TValue>.

Inheritance
object
ObjectCacheBase<TKey, TValue>
ClassObjectCacheBase<TKey, TValue>
GameObjectCache
Implements
IClassObjectCache<TKey, TValue>
IObjectCache<TKey, TValue>
ICollection<TValue>
IEnumerable<TValue>
IDictionary<TKey, TValue>
ICollection<KeyValuePair<TKey, TValue>>
IEnumerable<KeyValuePair<TKey, TValue>>
IEnumerable
Inherited Members
ObjectCacheBase<TKey, TValue>.Count
ObjectCacheBase<TKey, TValue>.IsReadOnly
ObjectCacheBase<TKey, TValue>.Keys
ObjectCacheBase<TKey, TValue>.Values
ObjectCacheBase<TKey, TValue>.Ages
ObjectCacheBase<TKey, TValue>.Objects
ObjectCacheBase<TKey, TValue>.this[TKey]
ObjectCacheBase<TKey, TValue>.GetObjectAge(TKey)
ObjectCacheBase<TKey, TValue>.GetObjectAge(TKey, DateTime)
ObjectCacheBase<TKey, TValue>.RefreshObject(TKey)
ObjectCacheBase<TKey, TValue>.RefreshObject(TKey, DateTime)
ObjectCacheBase<TKey, TValue>.Clear()
ObjectCacheBase<TKey, TValue>.Contains(TValue)
ObjectCacheBase<TKey, TValue>.ContainsKey(TKey)
ObjectCacheBase<TKey, TValue>.CopyTo(TValue[], int)
ObjectCacheBase<TKey, TValue>.Remove(TValue)
ObjectCacheBase<TKey, TValue>.Remove(TKey)
ObjectCacheBase<TKey, TValue>.GetEnumerator()
ObjectCacheBase<TKey, TValue>.Add(TValue)
ObjectCacheBase<TKey, TValue>.Add(TKey, TValue)
ObjectCacheBase<TKey, TValue>.Add(KeyValuePair<TKey, TValue>)
ObjectCacheBase<TKey, TValue>.TryGetValue(TKey, out TValue)
ObjectCacheBase<TKey, TValue>.Contains(KeyValuePair<TKey, TValue>)
ObjectCacheBase<TKey, TValue>.CopyTo(KeyValuePair<TKey, TValue>[], int)
ObjectCacheBase<TKey, TValue>.Remove(KeyValuePair<TKey, TValue>)
ObjectCacheBase<TKey, TValue>.GetKey(TValue)
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: Microsoft.XboxStudios.GameStateTracker.Cache
Assembly: GameStateTracker.Core.dll
Syntax
public abstract class ClassObjectCacheBase<TKey, TValue> : ObjectCacheBase<TKey, TValue>, IClassObjectCache<TKey, TValue>, IObjectCache<TKey, TValue>, ICollection<TValue>, IEnumerable<TValue>, IDictionary<TKey, TValue>, ICollection<KeyValuePair<TKey, TValue>>, IEnumerable<KeyValuePair<TKey, TValue>>, IEnumerable where TKey : IEquatable<TKey> where TValue : notnull
Type Parameters
Name Description
TKey

The info type.

TValue

The object type.

Constructors

View Source

ClassObjectCacheBase(IReadOnlyCollection<TValue>?)

Initializes a new instance of the ClassObjectCacheBase<TKey, TValue> class.

Declaration
protected ClassObjectCacheBase(IReadOnlyCollection<TValue>? existing = null)
Parameters
Type Name Description
IReadOnlyCollection<TValue> existing

The objects to initialize the cache with.

Methods

View Source

ClearClass(TKey)

Removes all matching objects from the cache.

Declaration
public void ClearClass(TKey classKey)
Parameters
Type Name Description
TKey classKey

The object info.

View Source

ClearClassAges(TKey)

Removes the age of objects with the given class from the cache.

Declaration
protected void ClearClassAges(TKey classKey)
Parameters
Type Name Description
TKey classKey

The class info.

View Source

GetClassAge(TKey)

Gets the age of a set of objects in the cache.

Declaration
public TimeSpan? GetClassAge(TKey classKey)
Parameters
Type Name Description
TKey classKey

The objects to search for.

Returns
Type Description
TimeSpan?

The time since the objects were last refreshed.

View Source

GetClassAge(TKey, DateTime)

Gets the age of a set of objects in the cache.

Declaration
public TimeSpan? GetClassAge(TKey classKey, DateTime now)
Parameters
Type Name Description
TKey classKey

The objects to search for.

DateTime now

The current time to compare to.

Returns
Type Description
TimeSpan?

The time since the objects were last refreshed.

View Source

GetObjectAge(TKey, DateTime)

Gets the age of an object in the cache.

Declaration
public override TimeSpan? GetObjectAge(TKey info, DateTime now)
Parameters
Type Name Description
TKey info

The object info.

DateTime now

The current time to compare to.

Returns
Type Description
TimeSpan?

The time since the object was last refreshed.

Overrides
ObjectCacheBase<TKey, TValue>.GetObjectAge(TKey, DateTime)
View Source

RefreshClass(TKey)

Updates the age of all matching objects in the cache.

Declaration
public void RefreshClass(TKey classKey)
Parameters
Type Name Description
TKey classKey

The objects to search for.

View Source

RefreshClass(TKey, DateTime)

Updates the age of all matching objects in the cache.

Declaration
public void RefreshClass(TKey classKey, DateTime now)
Parameters
Type Name Description
TKey classKey

The objects to search for.

DateTime now

The current time to set.

View Source

Remove(TKey)

Removes an object from the cache.

Declaration
public override bool Remove(TKey item)
Parameters
Type Name Description
TKey item

The object info.

Returns
Type Description
bool

True if the object was removed.

Overrides
ObjectCacheBase<TKey, TValue>.Remove(TKey)
View Source

ToClassKey(in TKey)

Converts an object's info to its class info.

Declaration
protected abstract TKey ToClassKey(in TKey info)
Parameters
Type Name Description
TKey info

The object info.

Returns
Type Description
TKey

The class info.

Implements

IClassObjectCache<TKey, TValue>
IObjectCache<TKey, TValue>
ICollection<T>
IEnumerable<T>
IDictionary<TKey, TValue>
ICollection<T>
IEnumerable<T>
IEnumerable
  • View Source
In this article
Back to top Generated by DocFX