Show / Hide Table of Contents

    Class LruCache<TKey, TValue>

    A cache implementation that uses the least recently used (LRU) policy to evict stale key-value pairs.

    Inheritance
    System.Object
    Cache<TKey, TValue>
    LruCache<TKey, TValue>
    Inherited Members
    Cache<TKey, TValue>.Insert(TKey, TValue)
    Cache<TKey, TValue>.TryGet(TKey, TValue)
    Cache<TKey, TValue>.Get(TKey, Func<TKey, TValue>)
    Cache<TKey, TValue>.ContainsKey(TKey)
    System.Object.ToString()
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    Namespace: Flame.Collections
    Assembly: Flame.dll
    Syntax
    public sealed class LruCache<TKey, TValue> : Cache<TKey, TValue>
    Type Parameters
    Name Description
    TKey
    TValue

    Constructors

    | Improve this Doc View Source

    LruCache(Int32)

    Creates an LRU cache with a particular capacity.

    Declaration
    public LruCache(int capacity)
    Parameters
    Type Name Description
    System.Int32 capacity

    The maximal number of key-value pairs in the LRU cache.

    | Improve this Doc View Source

    LruCache(Int32, IEqualityComparer<TKey>)

    Creates an LRU cache with a particular capacity and a key equality comparer.

    Declaration
    public LruCache(int capacity, IEqualityComparer<TKey> comparer)
    Parameters
    Type Name Description
    System.Int32 capacity

    The maximal number of key-value pairs in the LRU cache.

    System.Collections.Generic.IEqualityComparer<TKey> comparer

    An equality comparer for keys.

    Properties

    | Improve this Doc View Source

    Capacity

    Gets the LRU cache's capacity.

    Declaration
    public int Capacity { get; }
    Property Value
    Type Description
    System.Int32

    The maximal number of key-value pairs in the LRU cache.

    Methods

    | Improve this Doc View Source

    Get(TKey, Func<TKey, TValue>)

    Declaration
    public override TValue Get(TKey key, Func<TKey, TValue> createValue)
    Parameters
    Type Name Description
    TKey key
    System.Func<TKey, TValue> createValue
    Returns
    Type Description
    TValue
    Overrides
    Flame.Collections.Cache<TKey, TValue>.Get(TKey, System.Func<TKey, TValue>)
    | Improve this Doc View Source

    Insert(TKey, TValue)

    Declaration
    public override void Insert(TKey key, TValue value)
    Parameters
    Type Name Description
    TKey key
    TValue value
    Overrides
    Flame.Collections.Cache<TKey, TValue>.Insert(TKey, TValue)
    | Improve this Doc View Source

    TryGet(TKey, out TValue)

    Declaration
    public override bool TryGet(TKey key, out TValue value)
    Parameters
    Type Name Description
    TKey key
    TValue value
    Returns
    Type Description
    System.Boolean
    Overrides
    Flame.Collections.Cache<TKey, TValue>.TryGet(TKey, TValue)
    • Improve this Doc
    • View Source
    Back to top Generated by DocFX