Class FontCache<T>
Fixed-capacity, allocation-free-after-construction LRU cache keyed by Font.
public class FontCache<T>
Type Parameters
TThe cached value associated with a resolved font.
- Inheritance
-
FontCache<T>
- Derived
- Inherited Members
Constructors
FontCache(int)
Initializes a cache with the requested number of entries.
public FontCache(int capacity = 64)
Parameters
capacityint
Fields
DefaultCapacity
The standard number of font entries retained by a context cache.
public const int DefaultCapacity = 64
Field Value
Properties
EntryCapacity
Gets the number of retained font entries.
public int EntryCapacity { get; }
Property Value
Methods
Clear()
Clears every retained entry.
public void Clear()
OnEvicted(T)
Releases a value when its entry is replaced, evicted, or cleared.
protected virtual void OnEvicted(T value)
Parameters
valueT
Set(in Font, T)
Adds or refreshes the value for font.
public void Set(in Font font, T value)
Parameters
fontFontvalueT
TryGet(in Font, out T)
Gets the cached value for font when available.
public bool TryGet(in Font font, out T value)
Parameters
fontFontvalueT