Overview

This module provides integration between Drupal and Memcached, a highly efficient, in-memory key-value store. By moving your cache out of the database and into Memcache's RAM, you can dramatically reduce database load, speed up page rendering, and scale your site to handle high traffic.

Server Requirements

Before installing this module, your server or hosting environment must have the following installed and running:

  1. The memcached daemon (the actual memory caching service).
  2. The php-memcached extension (the PHP library that talks to the service).

Note: 8.x-2.x does support the older, deprecated PECL Memcache extension. Support for this library will be removed before 3.x.

🚀 Quick Start (Single Server Setup)

If you are running a standard site and your Memcache server is running on localhost:11211 (the default), getting started is incredibly simple. You do not need complex routing.

  1. Enable the Memcache module.
  2. Add the following lines to the bottom of your settings.php file:
       // Define Memcache as the default cache backend.
      $settings['cache']['default'] = 'cache.backend.memcache';
    

That's it! Drupal will now route standard cache requests to Memcache instead of your database.

🛠️ Advanced Features (For Enterprise & High-Traffic Sites)

Memcache is designed to scale. While the basic setup works for most, the module supports deep infrastructure tuning. See the README for detailed instructions on configuring the following and more:

  • Cache Bin Routing: Send large caches (like render or dynamic_page_cache) to dedicated Memcache instances while keeping smaller caches elsewhere.
  • Early Bootstrap Caching: Swap out the early container definition to bypass database queries entirely during Drupal's initial bootstrap phase.
  • Lock API Integration: Move Drupal's locking mechanism into Memcache to prevent database race conditions during cache stampedes.
  • Multi-Server Clustering: Distribute your cache across multiple physical servers.
  • Network Tuning: Advanced TCP configuration (like disabling Nagling) and custom key-hashing for maximum throughput.
Supporting organizations: 
Sponsored development
Sponsored 8.x-2.0 release

Project information

Releases