Sphyrnidae Common Library
2.0.1
Shared Utilities/Library
|
Storing items in the cache More...
Public Member Functions | |
bool | Get< T > (string key, out T item) |
Retrieves an item from the Cache More... | |
void | Set< T > (string key, T item) |
Sets an item into cache More... | |
T | Get< T > (string key, Func< T > method) |
Attempts to retrieve an item from cache. If not found in cache, will make callback to obtain the item from the caller which will be stored for later use More... | |
Task< T > | GetAsync< T > (string key, Func< Task< T >> method) |
Attempts to retrieve an item from cache. If not found in cache, will make callback to obtain the item from the caller which will be stored for later use More... | |
void | Remove (string key) |
Removes the given object from cache More... | |
Task< Exception > | RemoveAsync (string key) |
Removes the given object from cache More... | |
Properties | |
CacheOptions | Options [get] |
The options for storing items in cache More... | |
Storing items in the cache
T Sphyrnidae.Common.Cache.ICache.Get< T > | ( | string | key, |
Func< T > | method | ||
) |
Attempts to retrieve an item from cache. If not found in cache, will make callback to obtain the item from the caller which will be stored for later use
T | The type of item |
key | Name of the item in cache |
method | The callback function returning the item if not initially found in cache |
Implemented in Sphyrnidae.Common.Cache.CacheNone, Sphyrnidae.Common.Cache.CacheLocalAndDistributed, Sphyrnidae.Common.Cache.CacheLocal, and Sphyrnidae.Common.Cache.CacheDistributed.
bool Sphyrnidae.Common.Cache.ICache.Get< T > | ( | string | key, |
out T | item | ||
) |
Retrieves an item from the Cache
T | The type of item |
key | Name of the item in cache |
item | If the object is not found in the Cache, this will be populated |
Implemented in Sphyrnidae.Common.Cache.CacheNone, Sphyrnidae.Common.Cache.CacheLocalAndDistributed, Sphyrnidae.Common.Cache.CacheLocal, and Sphyrnidae.Common.Cache.CacheDistributed.
Task<T> Sphyrnidae.Common.Cache.ICache.GetAsync< T > | ( | string | key, |
Func< Task< T >> | method | ||
) |
Attempts to retrieve an item from cache. If not found in cache, will make callback to obtain the item from the caller which will be stored for later use
T | The type of item |
key | Name of the item in cache |
method | The callback function returning the item if not initially found in cache |
Implemented in Sphyrnidae.Common.Cache.CacheNone, Sphyrnidae.Common.Cache.CacheLocalAndDistributed, Sphyrnidae.Common.Cache.CacheLocal, and Sphyrnidae.Common.Cache.CacheDistributed.
void Sphyrnidae.Common.Cache.ICache.Remove | ( | string | key | ) |
Removes the given object from cache
Note that this removes from local cache, distributed cache, and via SignalR, all other local cache as well. Any errors in removal of the item will be hidden from the user, so it is preferred to use RemoveAsync if you need this exception handling.
key | Name of the item in cache |
Implemented in Sphyrnidae.Common.Cache.CacheNone, Sphyrnidae.Common.Cache.CacheLocalAndDistributed, Sphyrnidae.Common.Cache.CacheLocal, and Sphyrnidae.Common.Cache.CacheDistributed.
Task<Exception> Sphyrnidae.Common.Cache.ICache.RemoveAsync | ( | string | key | ) |
Removes the given object from cache
Note that this removes from local cache, distributed cache, and via SignalR, all other local cache as well
key | Name of the item in cache |
Implemented in Sphyrnidae.Common.Cache.CacheNone, Sphyrnidae.Common.Cache.CacheLocalAndDistributed, Sphyrnidae.Common.Cache.CacheLocal, and Sphyrnidae.Common.Cache.CacheDistributed.
void Sphyrnidae.Common.Cache.ICache.Set< T > | ( | string | key, |
T | item | ||
) |
Sets an item into cache
T | The type of item |
key | Name of the item in cache |
item | The item being set into cache |
Implemented in Sphyrnidae.Common.Cache.CacheNone, Sphyrnidae.Common.Cache.CacheLocalAndDistributed, Sphyrnidae.Common.Cache.CacheLocal, and Sphyrnidae.Common.Cache.CacheDistributed.
|
get |
The options for storing items in cache