Sphyrnidae Common Library  2.0.1
Shared Utilities/Library
Sphyrnidae.Common.Cache.CacheLocal Class Reference

Accessing local cache only More...

Inheritance diagram for Sphyrnidae.Common.Cache.CacheLocal:
Sphyrnidae.Common.Cache.ICache

Public Member Functions

 CacheLocal (DefaultCacheOptions options, IMemoryCache l1Cache)
 
virtual bool Get< T > (string key, out T item)
 Retrieves an item from the Cache More...
 
virtual void Set< T > (string key, T item)
 Sets an item into cache More...
 
virtual 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...
 
virtual 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...
 
virtual void Remove (string key)
 Removes the given object from local cache More...
 
virtual Task< Exception > RemoveAsync (string key)
 Removes the given object from local cache More...
 

Properties

CacheOptions Options [get]
 
IMemoryCache L1Cache [get]
 
- Properties inherited from Sphyrnidae.Common.Cache.ICache
CacheOptions Options [get]
 The options for storing items in cache More...
 

Detailed Description

Accessing local cache only

Constructor & Destructor Documentation

◆ CacheLocal()

Sphyrnidae.Common.Cache.CacheLocal.CacheLocal ( DefaultCacheOptions  options,
IMemoryCache  l1Cache 
)

Member Function Documentation

◆ Get< T >() [1/2]

virtual T Sphyrnidae.Common.Cache.CacheLocal.Get< T > ( string  key,
Func< T >  method 
)
virtual

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

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

Template Parameters
TThe type of item
Parameters
keyName of the item in cache
methodThe callback function returning the item if not initially found in cache
Returns
The object from cache/callback function

Implements Sphyrnidae.Common.Cache.ICache.

◆ Get< T >() [2/2]

virtual bool Sphyrnidae.Common.Cache.CacheLocal.Get< T > ( string  key,
out T  item 
)
virtual

Retrieves an item from the Cache

Retrieves an item from the Cache

Template Parameters
TThe type of item
Parameters
keyName of the item in cache
itemIf the object is not found in the Cache, this will be populated
Returns
True if the object was found, False if not found

Implements Sphyrnidae.Common.Cache.ICache.

◆ GetAsync< T >()

virtual Task<T> Sphyrnidae.Common.Cache.CacheLocal.GetAsync< T > ( string  key,
Func< Task< T >>  method 
)
virtual

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

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

Template Parameters
TThe type of item
Parameters
keyName of the item in cache
methodThe callback function returning the item if not initially found in cache
Returns
The object from cache/callback function

Implements Sphyrnidae.Common.Cache.ICache.

◆ Remove()

virtual void Sphyrnidae.Common.Cache.CacheLocal.Remove ( string  key)
virtual

Removes the given object from local cache

Removes the given object from cache

Parameters
keyName of the item in cache

Implements Sphyrnidae.Common.Cache.ICache.

◆ RemoveAsync()

virtual Task<Exception> Sphyrnidae.Common.Cache.CacheLocal.RemoveAsync ( string  key)
virtual

Removes the given object from local cache

Removes the given object from cache

Parameters
keyName of the item in cache
Returns
Always default(Exception) - eg. null

Implements Sphyrnidae.Common.Cache.ICache.

◆ Set< T >()

virtual void Sphyrnidae.Common.Cache.CacheLocal.Set< T > ( string  key,
item 
)
virtual

Sets an item into cache

Sets an item into cache

Template Parameters
TThe type of item
Parameters
keyName of the item in cache
itemThe item being set into cache

Implements Sphyrnidae.Common.Cache.ICache.

Property Documentation

◆ L1Cache

IMemoryCache Sphyrnidae.Common.Cache.CacheLocal.L1Cache
getprotected

◆ Options

CacheOptions Sphyrnidae.Common.Cache.CacheLocal.Options
get

The documentation for this class was generated from the following file: