Caching/ForgeTrust.Runnable.Caching/Memo.cs
Memo
Type
Memo
Memoizes async factory calls using with automatic key generation
and per-key thundering-herd protection.
Method
GetOrCreateCoreAsync<TState, TResult>(object, TState, Func<TState, CancellationToken, Task<TResult>>, CachePolicy, CancellationToken)
Core implementation that handles cache lookup, thundering-herd synchronization,
exception caching, and entry creation with the configured policy.
Uses a state-passing pattern to avoid closure allocations on the hot path.
can be a for efficiency.
null results from the factory are treated as valid cached values for reference types.
Method
CreateEntryOptions(SemaphoreSlim)
Creates with a post-eviction callback
that removes the corresponding from
to prevent unbounded growth.
Method
OnCacheEntryEvicted(object, object?, EvictionReason, object?)
Post-eviction callback that cleans up the per-key semaphore from the locks dictionary.
Only removes the exact semaphore instance that was captured when the cache entry was created,
preserving any newer semaphore created by concurrent callers via GetOrAdd.
Method
Dispose()
Disposes the underlying locks.
Type
CachedFailure
Sentinel wrapper stored in the cache when a factory invocation fails,
allowing subsequent waiters to short-circuit instead of re-invoking the factory.