Class DictionaryCache<TKey, TCachedObject>
- Namespace
- Dynamicweb.Caching
- Assembly
- Dynamicweb.Core.dll
In-memory dictionary-cache implementation
public class DictionaryCache<TKey, TCachedObject> : ServiceCache<TKey, TCachedObject>, IDisposable where TKey : IEquatable<TKey>
Type Parameters
TKey
Unique key for cached object
TCachedObject
Cached object
- Inheritance
-
Service
Cache <TKey, TCachedObject>DictionaryCache<TKey, TCachedObject>
- Implements
- Inherited Members
Constructors
DictionaryCache(Type)
Constructs a dictionary cache
Parameters
owner
Type
Properties
CountInternal
Property Value
InitializeCache
Lambda makes it possible to initialize all objects in the cache
Property Value
- Func<IDictionary<TKey, TCachedObject>>
Remarks
Useful when cache is often used for ids that do no exist in the database
Methods
ClearCacheInternal()
GetAllValuesInternal()
Gets all values stored in the object cache
Returns
- IEnumerable<TCachedObject>
values
GetCacheResult(IEnumerable<TKey>)
Gets a cacheresult that contains found objects and the keys that could not be found
Parameters
keys
IEnumerable<TKey>Unique cachekeys
Returns
- Cache
Result <TKey, TCachedObject> cacheresult
IsValid()
Returns
RemoveFromCache(IEnumerable<TKey>)
Parameters
keys
IEnumerable<TKey>
SetCacheInternal(TKey, TCachedObject)
Parameters
key
TKeycachedObject
TCachedObject