Redis provider settings reference

Version: 10.4

When you configure a Redis provider to host 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.

RequestResponse
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.

RequestResponse
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 true.

RequestResponse
compression="true"

connectionPoolSize

You configure connectionPoolSize to define the number of IConnectionMultiplexers created for communication with Redis. Default value is 1.

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.

RequestResponse
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, and ssl attributes to replace the connection string.

  • Configure the settingsClassName and settingsMethodName 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.

RequestResponse
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.

RequestResponse
databaseId="0"

host

You configure the host attribute to point to your Redis cache.

RequestResponse
host="127.0.0.1"

lastExceptionEnabled

You configure lastExceptionEnabled to indicate whether last exception is stored in HttpContext and suppresses subsequent calls to the provider during the request. Default value is false.

lockAgeMilliseconds

You configure lockAgeMilliseconds to define the maximum amount of time in milliseconds during which an item can stay locked in session state. Default value is system.web/httpRuntime/executionTimeout.

maxConcurrencyLevel

You configure maxConcurrencyLevel to determine how many threads that run simultaneously to add expired sessions to the in-memory queue. A default value is used if the attribute is not present. Default value is SessionExpirationThreadCount multiplied by SessionExpirationBatchSize multiplied by 2.

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.

RequestResponse
operationTimeoutInMilliseconds = "2000"

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.

RequestResponse
pollingBatchSize="200"

pollingEnabled

You configure the pollingEnabled attribute to enable or disable Redis client processing of expired sessions. The default value is true.

RequestResponse
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.

RequestResponse
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.

RequestResponse
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.

RequestResponse
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.

RequestResponse
pollingOnSlaves="false"
Important

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.

RequestResponse
port="6380"

retryTimeoutInMilliseconds

You configure the retryTimeoutInMilliseconds attribute to the timeout of the combined operation retries.

The Redis provider waits for 20 milliseconds before the first operation retry. If that retry fails, it waits 100 milliseconds before next try, and then doubles the timeout to 200 milliseconds and tries again. This procedure repeats with doubled timeouts until total time spend reached the value of retryTimeoutInMillisecond. If the operation still has not succeeded, an exception returns control to the caller (depending on the throwOnError setting).

The default value is 15000 milliseconds.

RequestResponse
retryTimeoutInMilliseconds="15000"

settingsClassName

You configure the settingsClassName attribute to an assembly and a class name that includes a settings method (see settingsMethodName).

RequestResponse
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.

RequestResponse
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.

Important
RequestResponse
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.

RequestResponse
throwOnError="true"

Do you have some feedback for us?

If you have suggestions for improving this article,