Page cover

Cache - Azure Cache for Redis

Here, you can find a tutorial on how to setup a Redis Cache on Azure to work with DecisionRules.

circle-info

From version 1.23.0, we recommend using Azure Managed Redis instead of Azure Cache for Redis for new environments, following Microsoft’s own recommendations.

All instances of Azure Cache for Redis tiers (Basic, Standard, and Premium) will be retired on September 30, 2028.

All instances of Azure Cache for Redis Enterprise and Enterprise Flash tiers will be retired on March 31, 2027.

https://learn.microsoft.com/en-us/azure/azure-cache-for-redis/retirement-faqarrow-up-right

Creating Azure Managed Redis

After navigating to Azure Managed Redis, hit Create. In the following screen assign your Resource group, give the cache a Name, choose a location and assign the SKU B1 type (or B3 if you want to use Active geo-replication). The type selection is up to you but we recommend a cache with at least 1GB of storage.

Basics

Basic Azure Managed Redis settings

Networking settings

circle-exclamation

After selecting Private Endpoint click Add private endpoint and fill in the settings. Location and resource group settings should correspond to those of your server containers'.

Networking settings

Advanced settings

circle-exclamation

Make sure the Eviction Policy is set to All Keys LRU or All Keys LFU.

Advanced settings

Enable Access Keys Authentication and keep the rest of the settings default unless your use-case demands otherwise.

Validate your settings and create the cache.

Connection strings

The format of your connection string will depend on whether you're using SSL or non-SSL connection.

  • SSL - rediss://default:<access_key>@<hostname>:<port>

  • Non-SSL - redis://default:<access_key>@<hostname>:<port>

Note the difference is in the first part of the string rediss:// x redis://.

  • You can find the <access_key> under Settings / Authentication / Access keys

  • You can find the <hostname> and <port> under Settings / Properties / Endpoint

Creating Azure Cache for Redis (retiring)

After navigating to Azure Cache for Redis, hit Create. In the following screen assign your Resource group, give the cache a DNS name, choose a location and assign the Standard C1 type. The type selection is up to you but we recommend a cache with at least 1GB of storage.

Basic Azure Cache for Redis settings

Networking settings

circle-exclamation

After selecting Private Endpoint click Add private endpoint and fill in the settings. Location and resource group settings should correspond to those of your server containers'.

Networking settings

Keep the rest of the settings default unless your use-case demands otherwise. Optionally also add tags for easier resource management.

Validate your settings and create the cache.

Necessary settings and connection strings

Maxmemory policy

After the cache has been provisioned, navigate to it's Settings/Advanced Settings tab. Once there, change the Maxmemory policy to allkeys-lru or allkeys-lfu.

Connection string

The format of your connection string will depend on whether you're using SSL or non-SSL connection.

  • SSL - rediss://<access_key>@<hostname>:<port>

  • Non-SSL - redis://<access_key>@<hostname>:<port>

Note the difference is in the first part of the string rediss:// x redis://.

  • You can find the <access_key> under Settings / Access keys

  • You can find the <hostname> and <port> under Settings / Properties

circle-exclamation

Error - Redis Client WRONGPASS

circle-info

Azure Cache for Redis tends to idle after a period of inactivity (10 minutes). To prevent this, and the corresponding expensive cache misses, we recommend setting the REDIS_PING_INTERVAL optional Environment Variable.

Last updated

Was this helpful?