---
title: "Redis provider settings reference"
slug: "redis-provider-settings-reference"
abstract: "Overview of available settings when configuring a Private or Shared Session State Store in a Redis provider."
---
# Redis provider settings reference

When you configure a Redis provider to host a [Private Session State Store](https://doc.sitecore.com/xp/en/developers/100/platform-administration-and-architecture/walkthrough--configuring-a-private-session-state-database-using-the-redis-provider.html "Walkthrough: Configuring a private session state database using the Redis provider"), you can add multiple attributes to the Redis provider configuration in the Sitecore `Web.config` file:

<details>
<summary><h2>accessKey</h2></summary>

You configure the `accessKey` attribute with the primary or the secondary access key to the Redis cache.

```text
accessKey="STKNJnBR9/DGaNoOATadRu/RY3PFFEZ7Xshk8B5NjNc="

```

</details>

<details>
<summary><h2>applicationName</h2></summary>

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.

```text
applicationName="private"

```

</details>

<details>
<summary><h2>compression</h2></summary>

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

```text
compression="false"

```

</details>

<details>
<summary><h2>connectionString</h2></summary>

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](https://stackexchange.github.io/StackExchange.Redis/Configuration).

```

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.

</details>

<details>
<summary><h2>connectionTimeoutInMilliseconds</h2></summary>

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](https://stackexchange.github.io/StackExchange.Redis/Configuration) for more information.

```text
connectionTimeoutInMilliseconds="5000"

```

</details>

<details>
<summary><h2>databaseId</h2></summary>

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.

```text
databaseId="0"

```

</details>

<details>
<summary><h2>host</h2></summary>

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

```text
host="127.0.0.1"

```

</details>

<details>
<summary><h2>operationTimeoutInMilliseconds</h2></summary>

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](https://stackexchange.github.io/StackExchange.Redis/Configuration) for more information.

```text
operationTimeoutInMilliseconds = "1000"

```

</details>

<details>
<summary><h2>maxConcurrencyLevel</h2></summary>

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.

</details>

<details>
<summary><h2>pollingBatchSize</h2></summary>

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](http://redis.io/commands/scan) for more information.

```text
pollingBatchSize="200"

```

</details>

<details>
<summary><h2>pollingEnabled</h2></summary>

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

```text
pollingEnabled="true"

```

</details>

<details>
<summary><h2>pollingExpirationTimeout</h2></summary>

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.

```text
pollingExpirationTimeout="120"

```

</details>

<details>
<summary><h2>pollingInterval</h2></summary>

You configure the `pollingInterval` attribute to how often the Redis client must check for expired sessions. The default value is `2` seconds.

```text
pollingInterval="2"

```

</details>

<details>
<summary><h2>pollingMaxExpiredSessionsPerSecond</h2></summary>

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.

```text
pollingMaxExpiredSessionsPerSecond="0"

```

</details>

<details>
<summary><h2>pollingOnSlaves</h2></summary>

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

```text
pollingOnSlaves="false"

```

> [!important]
> If you connect to a standalone Redis server configured for replication, you must add the `allowAdmin="true"` attribute when enabling `pollingOnSlaves`.

</details>

<details>
<summary><h2>port</h2></summary>

You configure the `port` attribute to to either your unprotected port or your SSL-protected port.

```text
port="6380"

```

</details>

<details>
<summary><h2>retryTimeoutInMilliseconds</h2></summary>

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.

```text
retryTimeoutInMilliseconds="5000"

```

</details>

<details>
<summary><h2>settingsClassName</h2></summary>

You configure the `settingsClassName` attribute to an assembly and a class name that includes a settings method (see [settingsMethodName](https://doc.sitecore.com/xp/en/developers/100/platform-administration-and-architecture/redis-provider-settings-reference.html#UUID-a859c647-9847-12a3-b3e9-2e1a9ce7709b_section-idm232003279847187 "settingsMethodName")).

```text
settingsClassName="Sitecore.SessionProvider.Redis.Settings, Sitecore.SessionProvider.Redis"

```

</details>

<details>
<summary><h2>settingsMethodName</h2></summary>

You configure the `settingsMethodName` attribute to a method in the settings class (see [settingsClassName](https://doc.sitecore.com/xp/en/developers/100/platform-administration-and-architecture/redis-provider-settings-reference.html#UUID-a859c647-9847-12a3-b3e9-2e1a9ce7709b_section-idm232003279067482 "settingsClassName")). The method must not require any parameters, and it must be public, static, and return a `[String]` with a `connectionString`.

```text
settingsMethodName="GetRedisConnectionString"

```

</details>

<details>
<summary><h2>ssl</h2></summary>

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](https://doc.sitecore.com/xp/en/developers/100/platform-administration-and-architecture/redis-provider-settings-reference.html#UUID-a859c647-9847-12a3-b3e9-2e1a9ce7709b_section-idm23200328204132 "port").

```text
ssl="true"

```

</details>

<details>
<summary><h2>throwOnError</h2></summary>

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

```text
throwOnError="true"

```

</details>