Class RedisConfigurationBuilderExtensions
Extensions for the configuration builder specific to the redis cache handle.
Inherited Members
Namespace:CacheManager.Core
Assembly:CacheManager.StackExchange.Redis.dll
Syntax
public static class RedisConfigurationBuilderExtensions
Methods
| Improve this Doc View SourceWithRedisBackplane(ConfigurationBuilderCachePart, String)
Configures a cache backplane for the cache manager. The redisConfigurationKey is used to find a matching redis configuration.
If a backplane is defined, at least one cache handle must be marked as backplane source. The cache manager then will try to synchronize multiple instances of the same configuration.
Declaration
public static ConfigurationBuilderCachePart WithRedisBackplane(this ConfigurationBuilderCachePart part, string redisConfigurationKey)
Parameters
| Type | Name | Description |
|---|---|---|
| ConfigurationBuilderCachePart | part | The builder instance. |
| String | redisConfigurationKey | The redis configuration key will be used to find a matching redis connection configuration. |
Returns
| Type | Description |
|---|---|
| ConfigurationBuilderCachePart | The builder instance. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException | Thrown if redisConfigurationKey is null. |
WithRedisBackplane(ConfigurationBuilderCachePart, String, String)
Configures a cache backplane for the cache manager. The redisConfigurationKey is used to find a matching redis configuration.
If a backplane is defined, at least one cache handle must be marked as backplane source. The cache manager then will try to synchronize multiple instances of the same configuration.
Declaration
public static ConfigurationBuilderCachePart WithRedisBackplane(this ConfigurationBuilderCachePart part, string redisConfigurationKey, string channelName)
Parameters
| Type | Name | Description |
|---|---|---|
| ConfigurationBuilderCachePart | part | The builder instance. |
| String | redisConfigurationKey | The redis configuration key will be used to find a matching redis connection configuration. |
| String | channelName | The pub sub channel name the backplane should use. |
Returns
| Type | Description |
|---|---|
| ConfigurationBuilderCachePart | The builder instance. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException | Thrown if redisConfigurationKey is null. |
WithRedisCacheHandle(ConfigurationBuilderCachePart, String, Boolean)
Adds a RedisCacheHandle<TCacheValue>. This handle requires a redis configuration to be defined with the given redisConfigurationKey.
Declaration
public static ConfigurationBuilderCacheHandlePart WithRedisCacheHandle(this ConfigurationBuilderCachePart part, string redisConfigurationKey, bool isBackplaneSource = true)
Parameters
| Type | Name | Description |
|---|---|---|
| ConfigurationBuilderCachePart | part | The builder instance. |
| String | redisConfigurationKey | The redis configuration key will be used to find a matching redis connection configuration. |
| Boolean | isBackplaneSource | Set this to true if this cache handle should be the source of the backplane. This setting will be ignored if no backplane is configured. |
Returns
| Type | Description |
|---|---|
| ConfigurationBuilderCacheHandlePart | The builder instance. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException | Thrown if redisConfigurationKey is null. |
WithRedisConfiguration(ConfigurationBuilderCachePart, String, IConnectionMultiplexer, Int32, Boolean)
Adds an existing StackExchange.Redis.IConnectionMultiplexer to the cache manager configuration which can be referenced by redis cache handle and/or backplane.
Declaration
[CLSCompliant(false)]
public static ConfigurationBuilderCachePart WithRedisConfiguration(this ConfigurationBuilderCachePart part, string configurationKey, IConnectionMultiplexer redisClient, int database = 0, bool enableKeyspaceNotifications = false)
Parameters
| Type | Name | Description |
|---|---|---|
| ConfigurationBuilderCachePart | part | The builder instance. |
| String | configurationKey | The configuration key which can be used to refernce this configuration by a redis cache handle or backplane. |
| StackExchange.Redis.IConnectionMultiplexer | redisClient | The connection multiplexer instance. |
| Int32 | database | The redis database to use for caching. |
| Boolean | enableKeyspaceNotifications | Enables keyspace notifications to react on eviction/expiration of items. Make sure that all servers are configured correctly and 'notify-keyspace-events' is at least set to 'Exe', otherwise CacheManager will not retrieve any events. See https://redis.io/topics/notifications#configuration for configuration details. |
Returns
| Type | Description |
|---|---|
| ConfigurationBuilderCachePart | The configuration builder. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException | If configurationKey or redisClient are null. |
WithRedisConfiguration(ConfigurationBuilderCachePart, String, Action<RedisConfigurationBuilder>)
Adds a redis configuration with the given configurationKey.
Declaration
public static ConfigurationBuilderCachePart WithRedisConfiguration(this ConfigurationBuilderCachePart part, string configurationKey, Action<RedisConfigurationBuilder> configuration)
Parameters
| Type | Name | Description |
|---|---|---|
| ConfigurationBuilderCachePart | part | The builder instance. |
| String | configurationKey | The configuration key which can be used to refernce this configuration by a redis cache handle or backplane. |
| Action<RedisConfigurationBuilder> | configuration | The redis configuration object. |
Returns
| Type | Description |
|---|---|
| ConfigurationBuilderCachePart | The configuration builder. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException | If configuration or configurationKey are null. |
WithRedisConfiguration(ConfigurationBuilderCachePart, String, String, Int32, Boolean)
Adds a redis configuration with the given configurationKey.
Declaration
public static ConfigurationBuilderCachePart WithRedisConfiguration(this ConfigurationBuilderCachePart part, string configurationKey, string connectionString, int database = 0, bool enableKeyspaceNotifications = false)
Parameters
| Type | Name | Description |
|---|---|---|
| ConfigurationBuilderCachePart | part | The builder instance. |
| String | configurationKey | The configuration key which can be used to refernce this configuration by a redis cache handle or backplane. |
| String | connectionString | The redis connection string. |
| Int32 | database | The redis database to be used. |
| Boolean | enableKeyspaceNotifications | Enables keyspace notifications to react on eviction/expiration of items. Make sure that all servers are configured correctly and 'notify-keyspace-events' is at least set to 'Exe', otherwise CacheManager will not retrieve any events. See https://redis.io/topics/notifications#configuration for configuration details. |
Returns
| Type | Description |
|---|---|
| ConfigurationBuilderCachePart | The configuration builder. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException | If configurationKey or connectionString are null. |