Class CacheManager
Manages cache objects
Inheritance
Inherited Members
Namespace: Simplic.Cache
Assembly: Simplic.CoreLib.dll
Syntax
public class CacheManager
Properties
| Improve this Doc View SourceEnableCaching
Caching
Declaration
public bool EnableCaching { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Singleton
Declaration
public static CacheManager Singleton { get; }
Property Value
Type | Description |
---|---|
CacheManager |
Methods
| Improve this Doc View SourceAddObject(ICacheable)
Fügt ein neues Objekt in den Cache ein
Declaration
public void AddObject(ICacheable Cacheable)
Parameters
Type | Name | Description |
---|---|---|
ICacheable | Cacheable | If set to true, the object will be ignored if it already exists |
AddObject(ICacheable, Boolean)
Fügt ein neues Objekt in den Cache ein
Declaration
public void AddObject(ICacheable Cacheable, bool ignoreIfExists = true)
Parameters
Type | Name | Description |
---|---|---|
ICacheable | Cacheable | If set to true, the object will be ignored if it already exists |
System.Boolean | ignoreIfExists | If set to true, existing objects will be ignored |
AddWeakReferenceObject<T>(T, Boolean)
Stores the object as a weak reference in the cache
Declaration
public void AddWeakReferenceObject<T>(T cacheable, bool ignoreIfExists = true)
where T : ICacheable
Parameters
Type | Name | Description |
---|---|---|
T | cacheable | Object to cache |
System.Boolean | ignoreIfExists | If set to true, existing objects will be ignored |
Type Parameters
Name | Description |
---|---|
T | Type of object to stre |
ClearCache()
Clears the whole cache
Declaration
public void ClearCache()
ClearCache(String)
Clears the cache and sends cache clear of the specified type
Declaration
public void ClearCache(string type)
Parameters
Type | Name | Description |
---|---|---|
System.String | type |
GenericCacheItemNoException<T>()
Returns the instance of a generic type just by passing its content type. The type of the data will be used for getting the item
Declaration
public GenericCacheItem<T> GenericCacheItemNoException<T>()
Returns
Type | Description |
---|---|
GenericCacheItem<T> |
Type Parameters
Name | Description |
---|---|
T | Type |
GetObject<T>(String)
Holt ein Objekt aus dem Cache und gibt es zurück
Declaration
public T GetObject<T>(string Key)
where T : ICacheable
Parameters
Type | Name | Description |
---|---|---|
System.String | Key | Eindeutiger schlüssel, anhand dessen das Objekt identifiziert wird |
Returns
Type | Description |
---|---|
T | Instanz eines Cache-Objekts |
Type Parameters
Name | Description |
---|---|
T |
GetObjectNoException<T>(String)
Holt ein Objekt aus dem Cache und gibt es zurück und wirft keine Exception falls das Objekt nicht gefunden werden konnte
Declaration
public T GetObjectNoException<T>(string Key)
where T : ICacheable
Parameters
Type | Name | Description |
---|---|---|
System.String | Key | Eindeutiger schlüssel, anhand dessen das Objekt identifiziert wird |
Returns
Type | Description |
---|---|
T | Instanz eines Cache-Objekts |
Type Parameters
Name | Description |
---|---|
T |
PrepareKey(String)
Prepare a key
Declaration
public static string PrepareKey(string key)
Parameters
Type | Name | Description |
---|---|---|
System.String | key |
Returns
Type | Description |
---|---|
System.String |
RemoveObject<T>(String)
Entfernt ein Cache-Objekt aus dem speicher
Declaration
public void RemoveObject<T>(string Key)
Parameters
Type | Name | Description |
---|---|---|
System.String | Key | Eindeutiger Schlüssel, anhand dessen das Objekt identifiziert wird |
Type Parameters
Name | Description |
---|---|
T |
RemoveObjectNoException<T>(String)
Entfernt ein Cache-Objekt aus dem speicher
Declaration
public void RemoveObjectNoException<T>(string Key)
Parameters
Type | Name | Description |
---|---|---|
System.String | Key | Eindeutiger Schlüssel, anhand dessen das Objekt identifiziert wird |
Type Parameters
Name | Description |
---|---|
T |
Events
| Improve this Doc View SourceCacheCleared
Cache clear event
Declaration
public event CacheClearedEventHandler CacheCleared
Event Type
Type | Description |
---|---|
CacheClearedEventHandler |