Show / Hide Table of Contents

Class MemoizationCacheFactoryExtensions

Extension methods for IMemoizationCacheFactory.

Inheritance
System.Object
MemoizationCacheFactoryExtensions
Namespace: System.Memory
Assembly: Nuqleon.Memory.dll
Syntax
public static class MemoizationCacheFactoryExtensions : Object

Methods

Synchronized(IMemoizationCacheFactory)

Creates a memoization cache factory that uses locking to access function memoization caches. This can be used to make a memoization cache safe for concurrent access, at the expense of potential lock contention.

Declaration
public static IMemoizationCacheFactory Synchronized(this IMemoizationCacheFactory factory)
Parameters
Type Name Description
IMemoizationCacheFactory factory

The memoization cache factory to wrap with synchronized access behavior.

Returns
Type Description
IMemoizationCacheFactory

A memoization cache factory that wraps the specified factory and adds synchronized access behavior to it.

WithThreadLocal(IMemoizationCacheFactory)

Creates a memoization cache factory that keeps function memoization caches for each thread on which the memoized function gets invoked. This is useful to reduce cache access lock contention and can be used to make a memoization cache safe for concurrent access, at the expense of keeping a cache per thread.

Declaration
public static IMemoizationCacheFactory WithThreadLocal(this IMemoizationCacheFactory factory)
Parameters
Type Name Description
IMemoizationCacheFactory factory

The memoization cache factory to wrap with thread-local caching behavior.

Returns
Type Description
IMemoizationCacheFactory

A memoization cache factory that wraps the specified factory and adds thread-local isolation to it.

WithThreadLocal(IMemoizationCacheFactory, Boolean)

Creates a memoization cache factory that keeps function memoization caches for each thread on which the memoized function gets invoked. This is useful to reduce cache access lock contention and can be used to make a memoization cache safe for concurrent access, at the expense of keeping a cache per thread.

Declaration
public static IMemoizationCacheFactory WithThreadLocal(this IMemoizationCacheFactory factory, bool exposeThreadLocalView)
Parameters
Type Name Description
IMemoizationCacheFactory factory

The memoization cache factory to wrap with thread-local caching behavior.

System.Boolean exposeThreadLocalView

Indicates whether the caches returned from the resulting factory provide a thread-local view on the cache, for properties like Count and methods like Clear.

Returns
Type Description
IMemoizationCacheFactory

A memoization cache factory that wraps the specified factory and adds thread-local isolation to it.

In This Article
Back to top Generated by DocFX