KGy SOFT

ThreadSafeCacheFactoryCreateTKey, TValue Method (FuncTKey, TValue, ThreadSafeCacheOptionsBase)

KGy SOFT Core Libraries Help

Namespace:  KGySoft.Collections
Assembly:  KGySoft.CoreLibraries (in KGySoft.CoreLibraries.dll) Version: 6.0.0-rc.2
Syntax

public static IThreadSafeCacheAccessor<TKey, TValue> Create<TKey, TValue>(
	Func<TKey, TValue> itemLoader,
	ThreadSafeCacheOptionsBase? options = null
)

Parameters

itemLoader
Type: SystemFuncTKey, TValue
A delegate for loading a value, which is invoked when a key is not present in the cache.
options (Optional)
Type: KGySoft.CollectionsThreadSafeCacheOptionsBase
The options for creating the cache. If , then a default LockFreeCacheOptions instance will be used. This parameter is optional.
Default value: .

Type Parameters

TKey
The type of the key in the cache.
TValue
The type of the value in the cache.

Return Value

Type: IThreadSafeCacheAccessorTKey, TValue
An IThreadSafeCacheAccessorTKey, TValue instance that can be used to read the underlying cache in a thread-safe manner.
See Also

Reference