ModelCache<T>

Models & Types · AiDotNet.Deployment.Runtime

Cache for model inference results.

For Beginners

ModelCache provides AI safety functionality. Default values follow the original paper settings.

Constructors

Constructor Summary
ModelCache(bool enabled)

Methods

Method Summary
CacheStatistics GetStatistics() Gets cache statistics.
T[] Get(string modelKey, T[] input) Gets a cached result for the given input.
int EvictLFU(int maxEntries) Evicts least frequently used entries.
int EvictLRU(int maxEntries) Evicts least recently used entries to maintain size limit.
int EvictOlderThan(TimeSpan maxAge) Removes entries older than the specified age.
void Clear() Clears the cache.
void Put(string modelKey, T[] input, T[] result) Puts a result in the cache.