This service is available via Telligent.Evolution.Extensibility.Caching.Version1.CacheService
Properties
| Name | Type | Description | Default | Options |
|---|---|---|---|---|
| PermissionsKey | string |
Methods
T Get<T>(string key, CacheScope scope, Func<T> load, GetOrPutOptions<T> options = null);
Retrieves an item from the cache (if the item is not currently cached, it is loaded and the cache is populated). Note that items identified to be cached in the distributed cache must have an associated IDistributedCacheSerializationProvider plugin to handle serialization/deserialization.
Parameters
| Name | Type | Description | Required | Default | Options |
|---|---|---|---|---|---|
| key | string | Key | Required | ||
| scope | CacheScope | Scope | Required | ||
| load | Func<T> | Load | Required | ||
| options | GetOrPutOptions<T> | Options | Optional |
Return Type
T
Task<T> GetAsync<T>(string key, CacheScope scope, Func<Task<T>> load, GetOrPutOptions<T> options = null);
Retrieves an item from the cache (if the item is not currently cached, it is loaded and the cache is populated). Note that items identified to be cached in the distributed cache must have an associated IDistributedCacheSerializationProvider plugin to handle serialization/deserialization.
Parameters
| Name | Type | Description | Required | Default | Options |
|---|---|---|---|---|---|
| key | string | Key | Required | ||
| scope | CacheScope | Scope | Required | ||
| load | Func<Task<T>> | Load | Required | ||
| options | GetOrPutOptions<T> | Options | Optional |
Return Type
Task<T>
void Put<T>(string key, CacheScope scope, T value, PutOptions options = null);
Puts an item into the cache. Puts are not propagated to all application instances (when adding/updating data, remove related cache entries and only put when loading data that is not already cached) Note that items identified to be cached in the distributed cache must have an associated IDistributedCacheSerializationProvider plugin to handle serialization/deserialization.
Parameters
| Name | Type | Description | Required | Default | Options |
|---|---|---|---|---|---|
| key | string | Key | Required | ||
| scope | CacheScope | Scope | Required | ||
| value | T | Value | Required | ||
| options | PutOptions | Options | Optional |
Task PutAsync<T>(string key, CacheScope scope, T value, PutOptions options = null);
Puts an item into the cache. Puts are not propagated to all application instances (when adding/updating data, remove related cache entries and only put when loading data that is not already cached). Note that items identified to be cached in the distributed cache must have an associated IDistributedCacheSerializationProvider plugin to handle serialization/deserialization.
Parameters
| Name | Type | Description | Required | Default | Options |
|---|---|---|---|---|---|
| key | string | Key | Required | ||
| scope | CacheScope | Scope | Required | ||
| value | T | Value | Required | ||
| options | PutOptions | Options | Optional |
Return Type
void Remove(string key, CacheScope scope, RemoveOptions options = null);
Removes an item from the cache. Removals are propagated to all application instances.
Parameters
| Name | Type | Description | Required | Default | Options |
|---|---|---|---|---|---|
| key | string | Key | Required | ||
| scope | CacheScope | Scope | Required | ||
| options | RemoveOptions | Options | Optional |
Task RemoveAsync(string key, CacheScope scope, RemoveOptions options = null);
Removes an item from the cache. Removals are propagated to all application instances.
Parameters
| Name | Type | Description | Required | Default | Options |
|---|---|---|---|---|---|
| key | string | Key | Required | ||
| scope | CacheScope | Scope | Required | ||
| options | RemoveOptions | Options | Optional |
Return Type
void RemoveByTags(string[] tags, RemoveByTagsOptions options = null);
Removes items from all cache scopes by tag. Removals are propagated to all application instances.
Parameters
| Name | Type | Description | Required | Default | Options |
|---|---|---|---|---|---|
| tags | string[] | Tags | Required | ||
| options | RemoveByTagsOptions | Options | Optional |
Task RemoveByTagsAsync(string[] tags, RemoveByTagsOptions options = null);
Removes items from all cache scopes by tag. Removals are propagated to all application instances.
Parameters
| Name | Type | Description | Required | Default | Options |
|---|---|---|---|---|---|
| tags | string[] | Tags | Required | ||
| options | RemoveByTagsOptions | Options | Optional |
Return Type
bool TryGet<T>(string key, CacheScope scope, out ref T value, GetOptions<T> options = null);
Attempts to retrieve an item from the cache. Returns whether the item exists in the cache.
Parameters
| Name | Type | Description | Required | Default | Options |
|---|---|---|---|---|---|
| key | string | Key | Required | ||
| scope | CacheScope | Scope | Required | ||
| value | ref T | Value | Required | ||
| options | GetOptions<T> | Options | Optional |
Return Type
Task<ValueTuple<bool,T>> TryGetAsync<T>(string key, CacheScope scope, GetOptions<T> options = null);
Attempts to retrieve an item from the cache. Returns whether the item exists in the cache and its value.
Parameters
| Name | Type | Description | Required | Default | Options |
|---|---|---|---|---|---|
| key | string | Key | Required | ||
| scope | CacheScope | Scope | Required | ||
| options | GetOptions<T> | Options | Optional |
Return Type
Task<ValueTuple<bool,T>>
string UserEffectivePermissionsKey(int userId);
Parameters
| Name | Type | Description | Required | Default | Options |
|---|---|---|---|---|---|
| userId | int | User Id | Required |
Return Type
string UserEffectivePermissionsKey(string userName);
Parameters
| Name | Type | Description | Required | Default | Options |
|---|---|---|---|---|---|
| userName | string | User Name | Required |
Return Type
string UserEffectivePermissionsKey(Guid userId);
Parameters
| Name | Type | Description | Required | Default | Options |
|---|---|---|---|---|---|
| userId | Guid | User Id | Required |