Documentation
Table of Contents

Class MemoryRequestCache

Namespace
IntentSharp.Resilience
Assembly
IntentSharp.dll

In-process cache with TTL and least-recently-used eviction.

public sealed class MemoryRequestCache : IRequestCache
Inheritance
object
MemoryRequestCache
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 capacity entries. 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 response under key for ttl, replacing any entry with the same key.