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.
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:
- Install Memcache on Server
- Verify that Memcache is running on the Server
- Install the Memcache module in Drupal
- Edit settings.php
- 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.
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.
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:
$conf['cache_backends'] = 'sites/all/modules/memcache/memcache.inc';
$conf['cache_default_class'] = 'MemCacheDrupal';
$conf['cache_class_cache_form'] = 'DrupalDatabaseCache';
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.
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!
Create interactive Drupal websites easily on the Cloud.
Host your website on optimized Drupal hosting servers.