Use Microsoft Azure Redis Cache with Drupal 7

1 minute read | By Yi Wang

1. Install Drupal Redis Module:

2. Subscribe Microsoft Azure Redis Cache:

3. Install Predis package:\

  • Download:\
  • Install: Unzip (downloaded from above link), create a folder “predis” at wwwroot, copy contents in “predis-1.0” to “wwwroot/predis”\
  • Run “php composer.phar install” (in the same directory with composer.json)


(If you do not have composer.phar installed, install it at wwwroot, download site:, you can use the curl command on Azure)

- Modify include_path in .user.ini: add include_path=’.;D:\home\site\wwwroot\predis’ )\

  • Require Predis package before use it: Add  require(“predis/autoload.php”); in PHP code

4. Configure Redis in Drupal:
In .settings.php, add following code to configure redis cache (sample code):


$conf[‘redis_client_interface’] = ‘Predis’;
$conf[‘redis_client_host’] = ‘<>’;
$conf[‘redis_client_port’] = 6379;
$conf[‘redis_client_password’] = ‘<Primary Access Key>’;
$conf[‘lock_inc’] = ‘sites/all/modules/contrib/redis/’;
$conf[‘cache_backends’][] = ‘sites/all/modules/contrib/redis/’;
$conf[‘cache_default_class’] = ‘Redis_Cache’;

Note: If SSL port 6380 does not work, turn on NON-SSL PORT 6379 (change the value of “Allow access only via SSL” to “No”)


5. Test:

- If the configuration works and connect to Azure Redis Cache, you should see the hostname and port populated in Drupal.

- Turn on Diagnostic in your Microsoft Azure Redis Cache, check the data from Monitoring tool, example data:


6. Reference: