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 supported on Turbo shared, Turbo reseller, Managed VPS, and Managed Dedicated server accounts.

 

Why Use Memcached with Drupal?

  • 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

Step 1: Install Dependencies and Module

  1. Log in to your server via SSH.

  2. Navigate to your Drupal installation directory.

  3. Run the following commands:

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

    Bash
    
    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.

 

Step 2: Configure Drupal Settings

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

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

    For Turbo Shared or Reseller Accounts:

    $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.

 

Step 3: Verify Memcached Integration

  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.

 

Important Notes

  • Memcached is not supported on non‑Turbo shared hosting accounts.

  • Always back up your site before making configuration changes.

  • For advanced options, see the modules/contrib/memcache/README.md file.

Was this answer helpful? 0 Users Found This Useful (0 Votes)

Powered by WHMCompleteSolution