How to Install Memcache on your Drupal 7 Site

by Hamza Zia  June 12, 2017

In my previous post, I showed you how to install and enable Redis cache on your Drupal 7 website hosted at Cloudways. However, that was just one way of speeding up your website. In this article, I will introduce Memcache, an alternate to to Redis that works equally well at speeding up your Drupal site. I will also discuss how to install Memcache on Drupal 7.

memcache on drupal 7 banner

Here’s what Wikipedia has to say about memcached: “Memcached (pronunciation: mem-cash-dee) is a general-purpose distributed memory caching system. It is often used to speed up dynamic database-driven websites by caching data and objects in RAM to reduce the number of times an external data source (such as a database or API) must be read.”

Memcache is different from Redis in that it is used to for object caching whereas Redis can be used as a DBMS as well as a server level cache. Given this, you can easily imagine the benefits of using both these caching options together.

Fortunately the process of setting up memcache on your Drupal website is super easy and involves the following steps:

  1. Install Memcache on Server
  2. Verify that Memcache is running on the Server
  3. Install the Memcache module in Drupal
  4. Edit settings.php
  5. Verify Memcache is active on your Drupal site

Install Memcache on Server

The first step is the installation of memcache on your server. The good news here is that Cloudways has memcache installed on your server by default so that you, the user, doesn’t have to go through the technical complexities of installing the service yourself.

Verify that Memcache is running on the Server

To verify whether memcache is running on your server, first login to your Cloudways account and go to the server’s dashboard. From here, click on the Services tab in the left panel. You will be presented with a list of services running on the server. Locate memcache and confirm that the status is set to running.

cloudways services status

Install the Memcache Module in Drupal

Now that you have verified the status of the memcache service, it’s time to move on to the Drupal side of things.

As with every other extended functionality available for Drupal, memcache too has a dedicated module. Go to the module page and download it. Install it on your Drupal website and make sure it is enabled after installation.

Edit settings.php

Similar to Redis, you will be required to add a few lines to your Drupal site’s settings.php for memcache to work properly.

After you’ve successfully installed and enabled the memcache module on your site, navigate to the sites/default folder and add the following lines to settings.php file:

Verify Memcache is Active on your Drupal site

To check the status of memcache on your site, simply navigate to the admin panel and go to reports/memcache.

Conclusion

As you can see, Cloudways makes it incredibly easy to take advantage of the power of memcache for your Drupal site. You do not need to know Linux commands or server administration to get up and running with Cloudways.

If you need any help in how to installing memcache on Drupal 7, do leave a comment and i will get back to you ASAP!

Start Creating Web Apps on Managed Cloud Servers Now!

Easy Web App Deployment for Agencies, Developers and E-Commerce Industry

About Hamza Zia

Hamza is a Drupal Community Manager at Cloudways - A Managed Drupal Hosting Platform. He loves to write about Drupal and related topics. During his free time, he can be seen obsessing over Football, Cars, Android and Gaming.

Stay Connected:

You Might Also Like...