NanoByte.Common  2.9.0
NanoByte.Common.Collections.TransparentCacheBase< TKey, TValue > Class Template Referenceabstract

Transparently caches retrieval requests, passed through to a template method on first request. More...

Inheritance diagram for NanoByte.Common.Collections.TransparentCacheBase< TKey, TValue >:
NanoByte.Common.Collections.TransparentCache< TKey, TValue >

Public Member Functions

bool Remove (TKey key)
 Removes the the entry with the specified key from the cache. More...
 
void Clear ()
 Removes all entries from the cache. More...
 

Protected Member Functions

abstract TValue Retrieve (TKey key)
 Template method used to retrieve values not yet in the cache. Usually only called once per key. May be called multiple times in multi-threaded scenarios. More...
 

Properties

TValue this[TKey key] [get]
 Retrieves a value from the cache. More...
 

Detailed Description

Transparently caches retrieval requests, passed through to a template method on first request.

This class is thread-safe.

Template Parameters
TKeyThe type of keys used to request values.
TValueThe type of values returned.
Type Constraints
TKey :notnull 

Member Function Documentation

◆ Clear()

void NanoByte.Common.Collections.TransparentCacheBase< TKey, TValue >.Clear ( )
inline

Removes all entries from the cache.

◆ Remove()

bool NanoByte.Common.Collections.TransparentCacheBase< TKey, TValue >.Remove ( TKey  key)
inline

Removes the the entry with the specified key from the cache.

Returns
true if a matching entry was found and removed; false if no matching entry was in the cache.

◆ Retrieve()

abstract TValue NanoByte.Common.Collections.TransparentCacheBase< TKey, TValue >.Retrieve ( TKey  key)
protectedpure virtual

Template method used to retrieve values not yet in the cache. Usually only called once per key. May be called multiple times in multi-threaded scenarios.

Implemented in NanoByte.Common.Collections.TransparentCache< TKey, TValue >.

Property Documentation

◆ this[TKey key]

TValue NanoByte.Common.Collections.TransparentCacheBase< TKey, TValue >.this[TKey key]
get

Retrieves a value from the cache.


The documentation for this class was generated from the following file: