Redis provider settings reference
When you configure a Redis provider to host a Shared Session State Store or a Private Session State Store, you can add multiple attributes to the Redis provider configuration in the Sitecore Web.config
file.
accessKey
You configure the accessKey
attribute with the primary or the secondary access key to the Redis cache.
accessKey="STKNJnBR9/DGaNoOATadRu/RY3PFFEZ7Xshk8B5NjNc="
applicationName
You configure the applicationName
attribute to private
or shared
to separate Private and Shared Session State Store data when hosted in the same Redis provider. The default value is empty, which makes Sitecore generate a value based on different system parameters.
applicationName="private"
compression
You configure the compression
attribute to true
to enable compression of session state data. Compressing session state data reduces the amount of data that you need to transfer between the Sitecore instance and the Redis database but might cause some additional CPU overhead. The default value is false
.
compression="false"
connectionString
You configure the connectionString
attribute to point to the Redis database. You can use a connection string name from the connectionStrings.config
file (it must be called redis
) or a valid StackExchange.Redis client connection string.
connectionString="session"
connectionString="127.0.0.1:6380"
Instead of configuring the connectionString
attribute, you can do one of the following:
-
Configure the
accessKey
,connectionTimeoutInMilliseconds
,host
,operationTimeoutInMilliseconds
,port
, andssl
attributes to replace the connection string. -
Configure the
settingsClassName
andsettingsMethodName
attributes to supply the connection string.
connectionTimeoutInMilliseconds
You configure the connectionTimeoutInMilliseconds
attribute to override the connectTimeout
setting in the Redis client. The default connectTimeout
value is 5000
milliseconds. See the StackExchange.Redis client configuration model documentation for more information.
connectionTimeoutInMilliseconds="5000"
databaseId
You configure the databaseId
attribute to one of the 16 databases that the default Redis configuration supports (they are numbered 0-15). The default value is 0
, which means that database 0 is used.
databaseId="0"
host
You configure the host
attribute to point to your Redis cache.
host="127.0.0.1"
operationTimeoutInMilliseconds
You configure the operationTimeoutInMilliseconds
attribute to override the syncTimeout
setting in the Redis client. The default syncTimeout
value is 5000
milliseconds. See the StackExhcange.Redis client configuration model documentation for more information.
operationTimeoutInMilliseconds = "1000"
pollingBatchSize
You configure the pollingBatchSize
attribute to the number of keys iterated with every call to the Redis cache. The default value is 200
keys. See the Redis SCAN documentation for more information.
pollingBatchSize="200"
pollingEnabled
You configure the pollingEnabled
attribute to enable or disable Redis client processing of expired sessions. The default value is true
.
pollingEnabled="true"
pollingExpirationTimeout
You configure the pollingExpirationTimeout
attribute to how long the Redis client ignores expired sessions before including them in Session End processing. The default value is 120
seconds.
pollingExpirationTimeout="120"
pollingInterval
You configure the pollingInterval
attribute to how often the Redis client must check for expired sessions. The default value is 2
seconds.
pollingInterval="2"
pollingMaxExpiredSessionsPerSecond
You configure the pollingMaxExpiredSessionsPerSecond
attribute to the number of expired sessions the Redis client processes per second. The default value is 0
seconds, which disables the setting.
pollingMaxExpiredSessionsPerSecond="0"
pollingOnSlaves
You configure the pollingOnSlaves
attribute to true
to make Redis scan slave servers for expired sessions. This is only relevant if you have multiple Redis servers configured for replication in a master/slave relationship. The default value is false
.
pollingOnSlaves="false"
If you connect to a standalone Redis server configured for replication, you must add the allowAdmin="true"
attribute when enabling pollingOnSlaves
.
port
You configure the port
attribute to to either your unprotected port or your SSL-protected port.
port="6380"
retryTimeoutInMilliseconds
You configure the retryTimeoutInMilliseconds
attribute to the timeout of the combined operation retries.
The Redis provider waits for 100 milliseconds before the first operation retry, and if that retry fails it doubles the timeout to 200 milliseconds and tries again. This procedure repeats with doubled timeouts until the retryTimeoutInMilliseconds
value is reached. If the operation still has not succeeded, an exception returns control to the caller (depending on the throwOnError
setting).
The default value is 5000
milliseconds.
retryTimeoutInMilliseconds="5000"
settingsClassName
You configure the settingsClassName
attribute to an assembly and a class name that includes a settings method (see settingsMethodName).
settingsClassName="Sitecore.SessionProvider.Redis.Settings, Sitecore.SessionProvider.Redis"
settingsMethodName
You configure the settingsMethodName
attribute to a method in the settings class (see settingsClassName). The method must not require any parameters, and it must be public, static, and return a [String]
with a connectionString
.
settingsMethodName="GetRedisConnectionString"
ssl
You configure the ssl
attribute to enable or disable SSL-protected communication between the Redis client and the Redis cache. The default value is true
.
You must specify the correct SSL port.
ssl="true"
throwOnError
You configure the throwOnError
setting to whether you want the Redis client to throw an exception in the event of a failure. The default value is true
.
throwOnError="true"