Managers.ICacheManager Interface
Namespace: Nucleus.Abstractions.Managers
Assembly: Nucleus.Abstractions.dll
Data cache manager.
Example
public class MyClass
{
private ICacheManager CacheManager { get; }
public MyClass(ICacheManager cacheManager, Context context)
{
this.CacheManager = cacheManager;
}
}
Methods
ClearAll
ClearAll ()
Clear all caches.
Collect
Collect ()
Remove expired items from all caches.
Get<TKey, TModel>
(String) Method
Get<TKey, TModel> (String caller)
Get the Cache collection for the specified type and entity, or create and add a new one if it does not exist.
Type Parameters
| TKey |
Key type. The type must have an implementation of the .ToString() function which returns a unique key for the cache item. |
| TModel |
Type of the data being stored in the cache. |
Parameters
| Name |
Type |
|
caller
|
String
A name for the cache collection. This parameter uses the CallerMemberName attribute to get the name of the class which called the method, and the
value is used as the name of the cache, as a configuration settings key, and in logging messages.
|
GetByName
(String) Method
GetByName (String cacheName)
Get an existing cache by name.
Report
Report ()
Report the current state of all caches.