Use Redis Cache Memcache Option on Azure with Drupal 7

1 minute read | By Yi Wang

Memcache is commonly used with Drupal sites to improve performance. If you find memcache client not supporting “Memcached Cloud” or Memcachier on Azure, here is a workaround

(refer to ).


1. Setup Redis Cache Service on Azure:


2. Enable Memcache shim from Redis Cache:

From Azure management portal, add following app settings in CONFIGURE:

Copy REDIS_HOST, REDIS_KEY values from your Redis Cache subscription


Note: Enable NON-SSL port 6379 from Redis Cache if SSL port 6380 is not supported by client library.


3. Install PHP memcache extension (php_memcache.dll) for your website, (download memcache extension for windows from )

To add the PHP extension, copy the downloaded php_memcache.dll to wwwroot/bin/ folder, add PHP EXTENSIONS to “app settings” in Azure management portal.

For more detail, refer to


4. Download and install memcache module on your Drupal site ( ), and add configuration in Settings.php:


$conf[‘memcache_servers’] = array(‘localhost:’.getenv(“MEMCACHESHIM_PORT”) => ‘default’);

$conf[‘cache_backends’][] = ‘sites/all/modules/memcache/’;

$conf[‘cache_default_class’] = ‘MemCacheDrupal’;

$conf[‘cache_class_cache_form’] = ‘DrupalDatabaseCache’;

$conf[‘memcache_key_prefix’] = ‘something_unique’;


5. To view cache hits, enable memcache from Drupal admin, and configure memcache statistic to show at bottom of pages, check the hit/miss ratio. View cache usage from Reids Cache account on Azure portal.