Pavalisoft.Caching  1.2.1
A single unified Caching Api for both MemoryCache and DistributedCache implementations including CacheManager
Pavalisoft.Caching.CacheManager Class Reference

Provides Cache Api ICacheManagerto interact with Cache Partitions for cache More...

Inheritance diagram for Pavalisoft.Caching.CacheManager:
Pavalisoft.Caching.Interfaces.ICacheManager

Public Member Functions

 CacheManager (ICacheSettingsProvider cacheSettingsProvider)
 Creates an instance of CacheManager with cache manager settings ICacheSettingsProvider More...
 
TItem Get< TItem > (string partitionName, string key)
 Gets cache item having specified cache key form the specified cache partitionName More...
 
async Task< TItem > GetAsync< TItem > (string partitionName, string key, CancellationToken token=default)
 Gets cache item having specified cache key form the specified cache partitionName More...
 
void Set< TItem > (string partitionName, string key, TItem value, IChangeToken expirationToken=null, PostEvictionCallbackRegistration postEvictionCallback=null)
 Adds an object to distributed cache More...
 
async Task SetAsync< TItem > (string partitionName, string key, TItem value, IChangeToken expirationToken=null, PostEvictionCallbackRegistration postEvictionCallback=null, CancellationToken token=default)
 Adds an object to distributed cache asynchronously More...
 
async Task SetAsync< TItem > (string partitionName, string key, TItem value, IChangeToken expirationToken, CancellationToken token=default)
 Adds an object to distributed cache asynchronously without post eviction callback More...
 
async Task SetAsync< TItem > (string partitionName, string key, TItem value, PostEvictionCallbackRegistration postEvictionCallback, CancellationToken token=default)
 Adds an object to distributed cache asynchronously without expiration change token More...
 
void Refresh (string partitionName, string key)
 Refreshes the cache item of the specified cache key More...
 
async Task RefreshAsync (string partitionName, string key, CancellationToken token=default)
 Refreshes the cache item asynchronously for the specified cache key More...
 
void Remove (string partitionName, string key)
 Removes the Cache object from the cache for the specified cache key More...
 
async Task RemoveAsync (string partitionName, string key, CancellationToken token=default)
 Removes the Cache object asynchronously from the cache for the specified cache key More...
 

Detailed Description

Provides Cache Api ICacheManagerto interact with Cache Partitions for cache

Constructor & Destructor Documentation

◆ CacheManager()

Pavalisoft.Caching.CacheManager.CacheManager ( ICacheSettingsProvider  cacheSettingsProvider)

Creates an instance of CacheManager with cache manager settings ICacheSettingsProvider

Parameters
cacheSettingsProviderICacheSettingsProvider provides cache manager configuration

Member Function Documentation

◆ Get< TItem >()

TItem Pavalisoft.Caching.CacheManager.Get< TItem > ( string  partitionName,
string  key 
)

Gets cache item having specified cache key form the specified cache partitionName

Template Parameters
TItemCache object type
Parameters
partitionNameCache Partition Name
keyCache key
Returns
Cache Item of TItem

Implements Pavalisoft.Caching.Interfaces.ICacheManager.

◆ GetAsync< TItem >()

async Task<TItem> Pavalisoft.Caching.CacheManager.GetAsync< TItem > ( string  partitionName,
string  key,
CancellationToken  token = default 
)

Gets cache item having specified cache key form the specified cache partitionName

Template Parameters
TItemCache object type
Parameters
partitionNameCache Partition Name
keyCache key
tokenCancellationToken to be used while getting cache item
Returns
Cache Item of TItem

Implements Pavalisoft.Caching.Interfaces.ICacheManager.

◆ Refresh()

void Pavalisoft.Caching.CacheManager.Refresh ( string  partitionName,
string  key 
)

Refreshes the cache item of the specified cache key

Parameters
partitionNameCache Partition Name
keyCache key

Implements Pavalisoft.Caching.Interfaces.ICacheManager.

◆ RefreshAsync()

async Task Pavalisoft.Caching.CacheManager.RefreshAsync ( string  partitionName,
string  key,
CancellationToken  token = default 
)

Refreshes the cache item asynchronously for the specified cache key

Parameters
partitionNameCache Partition Name
keyCache Key
tokenCancellationToken to be used while refreshing cache item

Implements Pavalisoft.Caching.Interfaces.ICacheManager.

◆ Remove()

void Pavalisoft.Caching.CacheManager.Remove ( string  partitionName,
string  key 
)

Removes the Cache object from the cache for the specified cache key

Parameters
partitionNameCache Partition Name
keyCache key

Implements Pavalisoft.Caching.Interfaces.ICacheManager.

◆ RemoveAsync()

async Task Pavalisoft.Caching.CacheManager.RemoveAsync ( string  partitionName,
string  key,
CancellationToken  token = default 
)

Removes the Cache object asynchronously from the cache for the specified cache key

Parameters
partitionNameCache Partition Name
keyCache key
tokenCancellationToken to be used while removing cache item

Implements Pavalisoft.Caching.Interfaces.ICacheManager.

◆ Set< TItem >()

void Pavalisoft.Caching.CacheManager.Set< TItem > ( string  partitionName,
string  key,
TItem  value,
IChangeToken  expirationToken = null,
PostEvictionCallbackRegistration  postEvictionCallback = null 
)

Adds an object to distributed cache

Template Parameters
TItemCache object type
Parameters
partitionNameCache Partition Name
keyCache Key
valueCache object
expirationTokenCache IChangeToken expiration token to be used while adding cache item
postEvictionCallbackPostEvictionCallbackRegistration delegate

Implements Pavalisoft.Caching.Interfaces.ICacheManager.

◆ SetAsync< TItem >() [1/3]

async Task Pavalisoft.Caching.CacheManager.SetAsync< TItem > ( string  partitionName,
string  key,
TItem  value,
IChangeToken  expirationToken = null,
PostEvictionCallbackRegistration  postEvictionCallback = null,
CancellationToken  token = default 
)

Adds an object to distributed cache asynchronously

Template Parameters
TItemCache object type
Parameters
partitionNameCache Partition Name
keyCache Key
valueCache object
expirationTokenCache IChangeToken expiration token to be used while adding cache item
postEvictionCallbackPostEvictionCallbackRegistration delegate
tokenCancellationToken to be used while setting cache item

Implements Pavalisoft.Caching.Interfaces.ICacheManager.

◆ SetAsync< TItem >() [2/3]

async Task Pavalisoft.Caching.CacheManager.SetAsync< TItem > ( string  partitionName,
string  key,
TItem  value,
IChangeToken  expirationToken,
CancellationToken  token = default 
)

Adds an object to distributed cache asynchronously without post eviction callback

Template Parameters
TItemCache object type
Parameters
partitionNameCache Partition Name
keyCache Key
valueCache object
expirationTokenCache IChangeToken expiration token to be used while adding cache item
tokenCancellationToken to be used while setting cache item

Implements Pavalisoft.Caching.Interfaces.ICacheManager.

◆ SetAsync< TItem >() [3/3]

async Task Pavalisoft.Caching.CacheManager.SetAsync< TItem > ( string  partitionName,
string  key,
TItem  value,
PostEvictionCallbackRegistration  postEvictionCallback,
CancellationToken  token = default 
)

Adds an object to distributed cache asynchronously without expiration change token

Template Parameters
TItemCache object type
Parameters
partitionNameCache Partition Name
keyCache Key
valueCache object
postEvictionCallbackPostEvictionCallbackRegistration delegate
tokenCancellationToken to be used while setting cache item

Implements Pavalisoft.Caching.Interfaces.ICacheManager.


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