Class MemoryRequestCache
- Namespace
- IntentSharp.Resilience
- Assembly
- IntentSharp.dll
In-process cache with TTL and least-recently-used eviction.
public sealed class MemoryRequestCache : IRequestCache
- Inheritance
-
objectMemoryRequestCache
- Implements
- Inherited Members
-
object.Equals(object)object.Equals(object, object)object.GetHashCode()object.GetType()object.ReferenceEquals(object, object)object.ToString()
- Extension Methods
Constructors
- MemoryRequestCache(int)
Creates an empty cache that holds at most
capacityentries. Storing a new key in a full cache removes the least recently used entry.
Methods
- ClearAsync(CancellationToken)
Removes every entry and resets the hit and miss counts to zero.
- GetAsync(string, CancellationToken)
Returns the response stored under
key, or null when there is none or it has expired; an expired entry is removed.
- GetStats()
Returns the hit, miss and entry counts.
- SetAsync(string, AIResponse, TimeSpan, CancellationToken)
Stores
responseunderkeyforttl, replacing any entry with the same key.