---
title: "Adding Redis connection options to Commerce caching configurations"
slug: "adding-redis-connection-options-to-commerce-caching-configurations"
abstract: "How to add Redis connection options to Commerce Engine and CE Connect caching configurations."
---
# Adding Redis connection options to Commerce caching configurations

You can add [Redis configuration options](https://stackexchange.github.io/StackExchange.Redis/Configuration.html#configuration-options) to the Redis connection settings specified in the Commerce Engine caching and Commerce Engine (CE) Connect caching configurations.

For Commerce Engine caching, you add Redis configuration options directly in the Commerce Engine `config.json` file. The path to the file is: `wwwroot\<CommerceEngine>\wwwroot\config.json`.

For Commerce Engine connect caching, you add your custom Redis configuration options in the `Custom.Commerce.Engine.Connect.config` patch file on the Sitecore instance. The path to the file is: `wwwroot\<SitecoreInstance>\App_Config\Include\Y.Commerce.Engine\CustomCommerce\Custom.Commerce.Engine.Connect.config`.

## Example: Add a Redis password property to the caching configuration

In the following examples, the connection to the Redis cache provider requires authentication. As a result, the Commerce Engine and Commerce Engine Connect configurations are updated to include the required `password` property and appropriate value.

The following shows an example of the Redis configuration in the Commerce Engine `config.json` file:

```csharp
"Redis":  {
      "Enabled":  true,
      "CacheStoreName":  "Commerce-Redis-Store",
      "IntervalBetweenConnectionAttemptsInSeconds":  60,
      "RedisConnectionPoolSize":  1,
      "RedisCompressionEnabled":  true,
          "Options":  {
                     "Configuration":  "localhost:6379,password=PASSWORD"
                      }

```

The following shows an example of the `"CacheSettings"` section in the default `Sitecore.Commerce.Engine.Connect.config` file:

> [!important]
> Do not make configuration changes directly in the `Sitecore.Commerce.Engine.Connect.config` file. To customize CE Connect configuration, use the `[Custom.Commerce.Engine.Connect.config patch file](patching-sitecore-commerce-engine-connect-configuration.html "Patching Sitecore Commerce Engine Connect configuration")`, or create your own patch file.

```xml
<cachingSettings type="Sitecore.Commerce.Engine.Connect.CachingSettings, Sitecore.Commerce.Engine.Connect.Caching">
    <redis type="Sitecore.Commerce.Engine.Connect.RedisCacheSettings, Sitecore.Commerce.Engine.Connect.Caching">
      <enabled>true</enabled>
      <cacheStoreName>Commerce-Connector-Redis</cacheStoreName>
      <intervalBetweenConnectionAttemptsInSeconds>60</intervalBetweenConnectionAttemptsInSeconds>
      <redisConnectionPoolSize>1</redisConnectionPoolSize>
      <redisCompressionEnabled>true</redisCompressionEnabled>
      <options type="Microsoft.Extensions.Caching.Redis.RedisCacheOptions, Microsoft.Extensions.Caching.Redis">
       <configuration>localhost:6379,defaultDatabase=1,allowAdmin=true,syncTimeout=3600000,password=PASSWORD</configuration>
       <instanceName>Redis</instanceName>
      </options>
</redis>

```