Skip to content

Configuring Drupal to use memcached

Memcached is a high‑performance, distributed memory caching system that stores frequently accessed data in RAM. Configuring Drupal to use Memcached can significantly improve site performance by reducing database queries. On ruachost.com, Memcached is available on Managed VPS accounts. Contact Ruachost support to check availability on your shared hosting plan.

  • Faster page load times by caching queries in memory.
  • Reduced database load.
  • Improved scalability for high‑traffic sites.
  • Enhanced performance for APIs and dynamic content.

Steps to Configure Drupal to Use Memcached

Section titled “Steps to Configure Drupal to Use Memcached”
  1. Log in to your server via SSH.

  2. Navigate to your Drupal installation directory.

  3. Run the following commands:

    Terminal window
    composer require drupal/memcache
  4. Copy the example Memcached services file:

    Terminal window
    cp modules/contrib/memcache/example.services.yml sites/default/memcache.services.yml
  5. Log in to Drupal as an administrator.

  6. Go to Extend → List tab → Performance.

  7. Check the box next to Memcache and click Install.

  8. You should see a confirmation message: Module Memcache has been enabled.

  1. Open the sites/default/settings.php file in a text editor.

  2. Add the following configuration based on your hosting type:

    For Shared Hosting Accounts (where available)

    Section titled “For Shared Hosting Accounts (where available)”
    $settings['memcache']['servers'] = ['/home/username/.memcache/memcached.sock' => 'default'];
    $settings['memcache']['bins'] = ['default' => 'default'];
    $settings['cache']['default'] = 'cache.backend.memcache';
    $settings['container_yamls'][] = 'sites/default/memcache.services.yml';

    (Replace username with your account username.)

  3. Save the file.

  1. In the Drupal admin menu, go to Reports → Memcache.
  2. Look for the message: Connected, using the Memcache backend.
  3. Review Memcached cache statistics to confirm proper integration.
  • Memcached is not available on every shared hosting plan. Contact Ruachost support to confirm availability for your account.
  • Always back up your site before making configuration changes.
  • For advanced options, see the modules/contrib/memcache/README.md file.