3 min - Drupal

Cache system for Drupal 10: Optimizing your website's performance

Published on Apr 19, 2024

Cache system for Drupal 10

Implementing an efficient cache system is essential to optimize your website's performance. Among the available options for developing these systems in Drupal, Redis, Memcache, and Varnish stand out as three powerful systems that can be integrated with Drupal to accelerate page loading and improve the user experience.

Redis offers excellent speed and scalability, with strong community support and regular updates that ensure optimal performance. On the other hand, Memcache, despite having a less active development community, remains a valid option for improving caching in Drupal 10.

Regarding Varnish, although it was popular in earlier versions of Drupal, it is not compatible with Drupal 10. Therefore, from DigitalProjex, we recommend using the two previously mentioned options to maximize your website’s performance in Drupal 10.

Redis

To use Redis as a caching system in Drupal, you must follow several key steps: installing Redis, configuring Drupal to use Redis, and finally, verifying that everything is working correctly. Below, we show how to do this, assuming Redis is already installed and running:

  • Install the Redis module in Drupal. This module has active development by the community, with its latest version dated June 23, 2023.
  • Configure Drupal to use Redis:  Edit your settings.php file to configure Drupal to use Redis as the cache backend. Add the following lines at the end of the file:
// Add at the end of settings.php
$settings['cache']['default'] = 'cache.backend.redis'; // Use Redis as the default cache backend.
$settings['redis.connection']['interface'] = 'PhpRedis'; // Use PhpRedis.
$settings['redis.connection']['host'] = '127.0.0.1'; // The IP address where Redis is listening.
$settings['redis.connection']['port'] = 6379; // The port Redis is listening on.
  • Clear Drupal cache.
  • To verify Redis integration, access the Drupal reports page, where you can see a small report showing Redis usage.

Redis Cache

 

Memcache

To use Memcache, you need to follow the steps outlined below:

Install the Memcache module on your Drupal site. This module has a less active community but is still valid. Its latest stable version is from August 2022.

  • Configure Drupal to use Memcache
  • Edit your settings.php file to configure Drupal to use Memcache as the cache backend. Add the following lines at the end of the file:
$settings['memcache']['servers'] = ['memcached:11211' => 'default'];
$settings['memcache']['bins'] = ['default' => 'default'];
$settings['memcache']['key_prefix'] = '';
$settings['cache']['default'] = 'cache.backend.memcache';
  • To verify Memcache integration, access the site’s reports page, where you can see a small report showing Memcache usage.

Maximizing the caching system in Drupal 10 with Redis and Memcache will allow you to offer a fast and efficient user experience.

If you'd like, you can contact us, and we will gladly help clarify any questions you have about Drupal development. At DigitalProjex, we specialize in this technology and have over 15 years of experience developing systems based on it.

Share This Post

Need consulting services to create a recipe for your company?

Contact Us
Blue chart
Read All Posts