Class RedisConfiguration
RedisConfiguration will be used for configuring e.g. StackExchange.Redis by code or configuration file.
The element was added only because StackExchange.Redis doesn't support configuration via web/app.config
Inherited Members
Namespace:CacheManager.Redis
Assembly:CacheManager.StackExchange.Redis.dll
Syntax
public class RedisConfiguration
Constructors
| Improve this Doc View SourceRedisConfiguration()
Initializes a new instance of the RedisConfiguration class.
Declaration
public RedisConfiguration()
RedisConfiguration(String, IList<ServerEndPoint>, Int32, String, Boolean, String, Int32, Boolean, Boolean, Boolean, String)
Initializes a new instance of the RedisConfiguration class.
Declaration
public RedisConfiguration(string key, IList<ServerEndPoint> endpoints, int database = 0, string password = null, bool isSsl = false, string sslHost = null, int connectionTimeout = 5000, bool allowAdmin = false, bool keyspaceNotificationsEnabled = false, bool twemproxyEnabled = false, string strictCompatibilityModeVersion = null)
Parameters
Type | Name | Description |
---|---|---|
String | key | The configuration key which will be used by the cache handle to find a configuration for the cache handle's name. |
IList<ServerEndPoint> | endpoints | The list of ServerEndPoint s to be used to connect to Redis server. |
Int32 | database | The Redis database index. |
String | password | The password of the Redis server. |
Boolean | isSsl | If |
String | sslHost | If specified, the connection will set the SSL host. |
Int32 | connectionTimeout | Sets the timeout used for connect operations. |
Boolean | allowAdmin | If set to |
Boolean | keyspaceNotificationsEnabled | Enables keyspace notifications to react on eviction/expiration of items. |
Boolean | twemproxyEnabled | Enables Twemproxy mode. |
String | strictCompatibilityModeVersion | Gets or sets a version number to eventually reduce the avaible features accessible by cachemanager. |
RedisConfiguration(String, String, Int32, Boolean, String)
Initializes a new instance of the RedisConfiguration class.
Declaration
public RedisConfiguration(string key, string connectionString, int database = 0, bool keyspaceNotificationsEnabled = false, string strictCompatibilityModeVersion = null)
Parameters
Type | Name | Description |
---|---|---|
String | key | The configuration key which will be used by the cache handle to find a configuration for the cache handle's name. |
String | connectionString | Instead of specifying all the properties, this can also be done via one connection string. |
Int32 | database | The redis database to use. |
Boolean | keyspaceNotificationsEnabled | Enables keyspace notifications to react on eviction/expiration of items. |
String | strictCompatibilityModeVersion | Gets or sets a version number to eventually reduce the avaible features accessible by cachemanager. |
Properties
| Improve this Doc View SourceAllowAdmin
Gets or sets a value indicating whether to allow the connection to run certain 'risky' commands, or not.
cache.Clear
requires this to be set to true because we will flush the Redis database.
Declaration
public bool AllowAdmin { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
|
ConfigurationOptions
Gets the StackExchange.Redis.ConfigurationOptions defined by this configuration.
Declaration
[CLSCompliant(false)]
public ConfigurationOptions ConfigurationOptions { get; }
Property Value
Type | Description |
---|---|
StackExchange.Redis.ConfigurationOptions |
ConnectionString
Gets or sets the connection string.
Declaration
public string ConnectionString { get; set; }
Property Value
Type | Description |
---|---|
String | The connection string. |
ConnectionTimeout
Gets or sets the timeout for any connect operations.
Declaration
public int ConnectionTimeout { get; set; }
Property Value
Type | Description |
---|---|
Int32 | The connection timeout. |
Database
Gets or sets the Redis database index the cache will use.
Declaration
public int Database { get; set; }
Property Value
Type | Description |
---|---|
Int32 | The database. |
Endpoints
Gets the list of endpoints to be used to connect to the Redis server.
Declaration
public IList<ServerEndPoint> Endpoints { get; }
Property Value
Type | Description |
---|---|
IList<ServerEndPoint> | The endpoints. |
IsSsl
Gets or sets a value indicating whether to use SSL encryption.
Declaration
public bool IsSsl { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
|
Key
Gets or sets the identifier for the redis configuration.
This might have to match with the cache handle's name to make the cache handle use this configuration.
Declaration
public string Key { get; set; }
Property Value
Type | Description |
---|---|
String | The key. |
KeyspaceNotificationsEnabled
Gets or sets a value indicating whether the redis cache handle should use keyspace notifications to react on evictions or expired events from redis and then forward those events to the cache manager. See https://redis.io/topics/notifications for technical details.
To use this feature, you might have to enable this feature on your redis server(s).
Declaration
public bool KeyspaceNotificationsEnabled { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
Password
Gets or sets the password to be used to connect to the Redis server.
Declaration
public string Password { get; set; }
Property Value
Type | Description |
---|---|
String | The password. |
SslHost
Gets or sets the SSL Host. If set, it will enforce this particular host on the server's certificate.
Declaration
public string SslHost { get; set; }
Property Value
Type | Description |
---|---|
String | The SSL host. |
StrictCompatibilityModeVersion
Gets or sets a version number to eventually reduce the avaible features accessible by cachemanager.
E.g. set this to "2.4"
to disable LUA support.
Declaration
public string StrictCompatibilityModeVersion { get; set; }
Property Value
Type | Description |
---|---|
String |
Remarks
This can also be used when automatic feature detection is not possible. Which is the case for example if TwemProxy is used, because the servers collection. to query the features, is not available/supported. CacheManager per default falls back to a version which supports LUA. If you are using a Redis server behind TwemPoxy which does not allow LUA, use this property!
TwemproxyEnabled
Gets or sets a value to indicate if Termproxy is being used.
Declaration
public bool TwemproxyEnabled { get; set; }
Property Value
Type | Description |
---|---|
Boolean |