Show / Hide Table of Contents

Class MemoizationCacheBase<T, TResult>

Base class for a cache to store memoization entries for a memoized function.

Inheritance
System.Object
MemoizationCacheBase
MemoizationCacheBase<T, TResult>
SynchronizedMemoizationCacheBase<T, TResult>
Implements
IMemoizationCache<T, TResult>
IMemoizationCache
IClearable
System.IDisposable
Inherited Members
MemoizationCacheBase.Clear()
MemoizationCacheBase.ClearCore(Boolean)
MemoizationCacheBase.Dispose()
MemoizationCacheBase.Dispose(Boolean)
MemoizationCacheBase.DisposeCore()
MemoizationCacheBase.CheckDisposed()
MemoizationCacheBase.Count
MemoizationCacheBase.CountCore
MemoizationCacheBase.DebugView
MemoizationCacheBase.DebugViewCore
Namespace: System.Memory
Assembly: Nuqleon.Memory.dll
Syntax
public abstract class MemoizationCacheBase<T, TResult> : MemoizationCacheBase, IMemoizationCache<T, TResult>, IMemoizationCache, IClearable, IDisposable
Type Parameters
Name Description
T

Type of the memoized function argument.

TResult

Type of the memoized function result.

Constructors

MemoizationCacheBase()

Declaration
protected MemoizationCacheBase()

Methods

GetOrAdd(T)

Gets the result of invoking the memoized function with the specified argument. If the memoization cache does not have the result of the function invocation stored yet, it will call the function.

Declaration
public virtual TResult GetOrAdd(T argument)
Parameters
Type Name Description
T argument

The argument to get the function invocation result for.

Returns
Type Description
TResult

The function invocation result.

GetOrAddCore(T)

Gets the result of invoking the memoized function with the specified argument. If the memoization cache does not have the result of the function invocation stored yet, it will call the function.

Declaration
protected abstract TResult GetOrAddCore(T argument)
Parameters
Type Name Description
T argument

The argument to get the function invocation result for.

Returns
Type Description
TResult

The function invocation result.

Implements

IMemoizationCache<T, TResult>
IMemoizationCache
IClearable
System.IDisposable
In This Article
Back to top Generated by DocFX