Show / Hide Table of Contents

Class SynchronizedMemoizationCacheBase<T, TResult>

Base class for a cache to store memoization entries for a memoized function. Access to the cache gets synchronized through a lock.

Inheritance
System.Object
MemoizationCacheBase
MemoizationCacheBase<T, TResult>
SynchronizedMemoizationCacheBase<T, TResult>
Implements
IMemoizationCache<T, TResult>
IMemoizationCache
IClearable
System.IDisposable
Inherited Members
MemoizationCacheBase<T, TResult>.GetOrAdd(T)
MemoizationCacheBase<T, TResult>.GetOrAddCore(T)
MemoizationCacheBase.ClearCore(Boolean)
MemoizationCacheBase.Dispose()
MemoizationCacheBase.DisposeCore()
MemoizationCacheBase.CheckDisposed()
MemoizationCacheBase.CountCore
MemoizationCacheBase.DebugViewCore
Namespace: System.Memory
Assembly: Nuqleon.Memory.dll
Syntax
public abstract class SynchronizedMemoizationCacheBase<T, TResult> : MemoizationCacheBase<T, TResult>, 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

SynchronizedMemoizationCacheBase()

Declaration
protected SynchronizedMemoizationCacheBase()

Properties

Count

Gets the number of entries in the cache.

Declaration
public override int Count { get; }
Property Value
Type Description
System.Int32
Overrides
MemoizationCacheBase.Count

DebugView

Gets a debug view on the memoization cache.

Declaration
public override string DebugView { get; }
Property Value
Type Description
System.String
Overrides
MemoizationCacheBase.DebugView

SyncRoot

Gets an object to synchronize access to the cache on.

Declaration
protected abstract object SyncRoot { get; }
Property Value
Type Description
System.Object

Methods

Clear()

Clears the entries in the cache.

Declaration
public override void Clear()
Overrides
MemoizationCacheBase.Clear()

Dispose(Boolean)

Disposes the cache.

Declaration
protected override void Dispose(bool disposing)
Parameters
Type Name Description
System.Boolean disposing

Indicates whether the dispose operation is triggered by a call to Dispose, or the finalizer.

Overrides
MemoizationCacheBase.Dispose(Boolean)

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 override 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.

Overrides
System.Memory.MemoizationCacheBase<T, TResult>.GetOrAdd(T)

Implements

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