Class RedisConfigurationBuilder
RedisConfigurationBuilder helps creating the RedisConfiguration object via code.
Inherited Members
Namespace:CacheManager.Redis
Assembly:CacheManager.StackExchange.Redis.dll
Syntax
public class RedisConfigurationBuilder
Constructors
| Improve this Doc View SourceRedisConfigurationBuilder(String)
Initializes a new instance of the RedisConfigurationBuilder class.
Declaration
public RedisConfigurationBuilder(string configurationKey)
Parameters
Type | Name | Description |
---|---|---|
String | configurationKey | The configuration key. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | If configurationKey is null. |
Methods
| Improve this Doc View SourceBuild()
Creates the RedisConfiguration out of the currently specified properties, if possible.
Declaration
public RedisConfiguration Build()
Returns
Type | Description |
---|---|
RedisConfiguration | The |
EnableKeyspaceEvents()
Enable the flag to have CacheManager react on keyspace notifications from redis. CacheManager will listen only for eviction and expiration events (not all events). Use this feature only if you also have configured Redis correctly: notify-keyspace-events must be set to AT LEAST Exe. https://redis.io/topics/notifications#configuration
Declaration
public RedisConfigurationBuilder EnableKeyspaceEvents()
Returns
Type | Description |
---|---|
RedisConfigurationBuilder | The builder. |
UseCompatibilityMode(String)
Can be used to control the available Redis features CacheManager can use. E.g. if set to "2.4"
, this would disable all LUA support and would
force CacheManager to use other APIs
Declaration
public RedisConfigurationBuilder UseCompatibilityMode(string version)
Parameters
Type | Name | Description |
---|---|---|
String | version |
Returns
Type | Description |
---|---|
RedisConfigurationBuilder | The builder. |
UseTwemproxy()
Enable this in case you are using Redis behind Twemproxy.
Declaration
[CLSCompliant(false)]
public RedisConfigurationBuilder UseTwemproxy()
Returns
Type | Description |
---|---|
RedisConfigurationBuilder | The builder. |
WithAllowAdmin()
If set to true, commands which might be risky are enabled, like Clear which will delete all entries in the redis database.
Declaration
public RedisConfigurationBuilder WithAllowAdmin()
Returns
Type | Description |
---|---|
RedisConfigurationBuilder | The builder. |
WithConnectionTimeout(Int32)
Sets the timeout in milliseconds for connect operations.
Declaration
public RedisConfigurationBuilder WithConnectionTimeout(int timeout)
Parameters
Type | Name | Description |
---|---|---|
Int32 | timeout | The timeout in milliseconds. |
Returns
Type | Description |
---|---|
RedisConfigurationBuilder | The builder. |
WithDatabase(Int32)
Sets the database.
Maximum number of database depends on the redis server configuration.
Default is0
.
Declaration
public RedisConfigurationBuilder WithDatabase(int databaseIndex)
Parameters
Type | Name | Description |
---|---|---|
Int32 | databaseIndex | The database index. |
Returns
Type | Description |
---|---|
RedisConfigurationBuilder | The builder. |
WithEndpoint(String, Int32)
Adds an endpoint to the connection configuration.
Call this multiple times to add multiple endpoints.
Declaration
public RedisConfigurationBuilder WithEndpoint(string host, int port)
Parameters
Type | Name | Description |
---|---|---|
String | host | The host or IP of the redis server. |
Int32 | port | The port of the redis server. |
Returns
Type | Description |
---|---|
RedisConfigurationBuilder | The builder. |
WithPassword(String)
Sets the password for the redis server.
Declaration
public RedisConfigurationBuilder WithPassword(string serverPassword)
Parameters
Type | Name | Description |
---|---|---|
String | serverPassword | The redis server password. |
Returns
Type | Description |
---|---|
RedisConfigurationBuilder | The builder. |
WithSsl(String)
Enables SSL encryption.
If host is specified it will enforce a particular SSL host identity on the server's certificate.
Declaration
public RedisConfigurationBuilder WithSsl(string host = null)
Parameters
Type | Name | Description |
---|---|---|
String | host | The SSL host. |
Returns
Type | Description |
---|---|
RedisConfigurationBuilder | The builder. |