Redis provider settings reference
Overview of available settings when configuring a Private or Shared Session State Store in a Redis provider.
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.
You configure the accessKey
attribute with the primary or the secondary access key to the Redis cache.
accessKey="STKNJnBR9/DGaNoOATadRu/RY3PFFEZ7Xshk8B5NjNc="
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"
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"
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"
Tip
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.
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"
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"
You configure the host
attribute to point to your Redis cache.
host="127.0.0.1"
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"
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"
You configure the pollingEnabled
attribute to enable or disable Redis client processing of expired sessions. The default value is true
.
pollingEnabled="true"
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"
You configure the pollingInterval
attribute to how often the Redis client must check for expired sessions. The default value is 2
seconds.
pollingInterval="2"
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"
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"
Important
If you connect to a standalone Redis server configured for replication, you must add the allowAdmin="true"
attribute when enabling pollingOnSlaves
.
You configure the port
attribute to to either your unprotected port or your SSL-protected port.
port="6380"
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"
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"
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"
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
.
Important
You must specify the correct SSL port.
ssl="true"
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"