Class RedisCacheService
Represents a caching service that uses Redis as the cache provider.
Inherited Members
Namespace: Innovt.Cloud.AWS.Caching
Assembly: Innovt.Cloud.AWS.Caching.dll
Syntax
public class RedisCacheService : AwsBaseService, ICacheService, IDisposable
Constructors
| Edit this page View SourceRedisCacheService(ILogger, IAwsConfiguration, RedisProviderConfiguration)
Initializes a new instance of the RedisCacheService class.
Declaration
public RedisCacheService(ILogger logger, IAwsConfiguration configuration, RedisProviderConfiguration providerConfiguration)
Parameters
Type | Name | Description |
---|---|---|
ILogger | logger | The logger instance for logging. |
IAwsConfiguration | configuration | The AWS configuration. |
RedisProviderConfiguration | providerConfiguration | The configuration for the Redis cache provider. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown when |
Fields
| Edit this page View SourceRedisProviderActivitySource
Declaration
protected static readonly ActivitySource RedisProviderActivitySource
Field Value
Type | Description |
---|---|
ActivitySource |
Methods
| Edit this page View SourceDisposeServices()
Disposes of resources used by the RedisCacheService.
Declaration
protected override void DisposeServices()
Overrides
| Edit this page View SourceGetValue<T>(string)
Gets a cached value of type T
associated with the specified key.
Declaration
public T GetValue<T>(string key)
Parameters
Type | Name | Description |
---|---|---|
string | key | The key associated with the cached value. |
Returns
Type | Description |
---|---|
T | The cached value if found; otherwise, the default value for |
Type Parameters
Name | Description |
---|---|
T | The type of the cached value. |
Remove(string)
Removes a cached value associated with the specified key.
Declaration
public void Remove(string key)
Parameters
Type | Name | Description |
---|---|---|
string | key | The key associated with the cached value to remove. |
SetValue<T>(string, T, TimeSpan)
Sets a cached value of type T
associated with the specified key.
Declaration
public void SetValue<T>(string key, T entity, TimeSpan expiration)
Parameters
Type | Name | Description |
---|---|---|
string | key | The key to associate with the cached value. |
T | entity | The value to cache. |
TimeSpan | expiration | The expiration time for the cached value. |
Type Parameters
Name | Description |
---|---|
T | The type of the value to cache. |