Show / Hide Table of Contents

Class WeakMemoizationCacheFactoryExtensions

Extension methods for IWeakMemoizationCacheFactory.

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

Methods

WithThreadLocal(IWeakMemoizationCacheFactory)

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 IWeakMemoizationCacheFactory WithThreadLocal(this IWeakMemoizationCacheFactory factory)
Parameters
Type Name Description
IWeakMemoizationCacheFactory factory

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

Returns
Type Description
IWeakMemoizationCacheFactory

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

WithThreadLocal(IWeakMemoizationCacheFactory, 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 IWeakMemoizationCacheFactory WithThreadLocal(this IWeakMemoizationCacheFactory factory, bool exposeThreadLocalView)
Parameters
Type Name Description
IWeakMemoizationCacheFactory 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
IWeakMemoizationCacheFactory

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