Table of Contents

Class FixedSizeMemoryCache<TKey, TValue>

Namespace
Gamelogic.Extensions
Assembly
Assembly-CSharp.dll

A cache maintained in memory that stays fixed in size.

public class FixedSizeMemoryCache<TKey, TValue> : ICache<TKey, TValue>

Type Parameters

TKey
TValue
Inheritance
FixedSizeMemoryCache<TKey, TValue>
Implements
ICache<TKey, TValue>
Inherited Members
Extension Methods

Constructors

FixedSizeMemoryCache(int)

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

public FixedSizeMemoryCache(int capacity)

Parameters

capacity int

The capacity of the cache, must be positive.

Properties

Count

Gets the number of elements in the cache .

public int Count { get; }

Property Value

int

IsFull

Gets a value indicating whether this cache is full.

public bool IsFull { get; }

Property Value

bool

true if this cache is full; otherwise, false.

this[TKey]

Gets or sets the value with the specified key. The method ContainsKey should always be called before getting the value of a key.

public TValue this[TKey key] { get; set; }

Parameters

key TKey

Property Value

TValue

Methods

ContainsKey(TKey)

Determines whether this cache contains the specified key.

public bool ContainsKey(TKey key)

Parameters

key TKey

Returns

bool

true if the cache contains the key; otherwise, false.

Remove(TKey)

Removes the element at the specified key from the cache.

public TValue Remove(TKey key)

Parameters

key TKey

The key.

Returns

TValue

TValue.

RemoveOldest()

Removes the oldest item from the cache.

public KeyValuePair<TKey, TValue> RemoveOldest()

Returns

KeyValuePair<TKey, TValue>

KeyValuePair<TKey, TValue>.