CacheTKey, TValueGetThreadSafeAccessor Method
Gets a thread safe accessor for this
CacheTKey, TValue instance. As it provides only a
single readable indexer, it makes sense only if an item loader was passed to the appropriate
constructor
and the cache will not be accessed by other members but via the returned accessor.
Namespace: KGySoft.CollectionsAssembly: KGySoft.CoreLibraries (in KGySoft.CoreLibraries.dll) Version: 9.0.0-preview.1
public IThreadSafeCacheAccessor<TKey, TValue> GetThreadSafeAccessor(
bool protectItemLoader = false
)
Public Function GetThreadSafeAccessor (
Optional protectItemLoader As Boolean = false
) As IThreadSafeCacheAccessor(Of TKey, TValue)
public:
IThreadSafeCacheAccessor<TKey, TValue>^ GetThreadSafeAccessor(
bool protectItemLoader = false
)
member GetThreadSafeAccessor :
?protectItemLoader : bool
(* Defaults:
let _protectItemLoader = defaultArg protectItemLoader false
*)
-> IThreadSafeCacheAccessor<'TKey, 'TValue>
- protectItemLoader Boolean (Optional)
- to ensure that also the item loader is locked if a new element has to be loaded and
to allow the item loader to be called concurrently. In latter case the CacheTKey, TValue is not locked during the time the item loader is being called
but it can happen that values for same key are loaded multiple times and all but one will be discarded. This parameter is optional.
Default value: .
IThreadSafeCacheAccessorTKey,
TValueAn
IThreadSafeCacheAccessorTKey, TValue instance providing a thread-safe readable indexer for this
CacheTKey, TValue instance.