Nucleus .Net Core CMS

Managers.ICacheManager Interface

Namespace: Nucleus.Abstractions.Managers
Assembly: Nucleus.Abstractions.dll
Data cache manager.
Get an instance of this class from dependency injection by including a parameter in your class constructor.
public class MyClass 
{ 
  private ICacheManager CacheManager { get; } 
  public MyClass(ICacheManager cacheManager, Context context) 
  { 
    this.CacheManager = cacheManager; 
  } 
}
ClearAll ()
Clear all caches.
Collect ()
Remove expired items from all caches.
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.

Remarks
Cache options for the specified entity are automatically read from configuration. The configuration file key is Nucleus:CacheOptions:[cache-name]. The caller should be an extension method, see Caching Data for details. Get an instance of this class from dependency injection by including a parameter in your class constructor.
GetByName (String cacheName)
Get an existing cache by name.
Parameters
Name Type
cacheName String
Report ()
Report the current state of all caches.
Caching Data