This article describes how to configure Drupal 9 to use Redis.
Redis is an open-source memory object caching system that websites can use to help accelerate page load times. Redis works by caching in RAM frequently accessed data, such as the results of API calls, database calls, and more.
First, you must install some dependencies and a module so Drupal can access and use Redis. To do this, follow these steps:
composer require predis/predis composer require drupal/redis cp modules/contrib/redis/example.services.yml sites/default/redis.services.yml
After you install and enable the Redis module, you are ready to configure Drupal to actually use Redis. To do this, follow these steps:
$settings['redis.connection']['interface'] = 'Predis'; $settings['redis.connection']['host'] = 'localhost'; $settings['redis.connection']['port'] = '6379'; $settings['cache']['default'] = 'cache.backend.redis'; $settings['container_yamls'] = 'sites/default/redis.services.yml';
Save your changes to the settings.php file. Redis is now configured for Drupal.
For more information about Redis, please visit https://redis.io.
Subscribe to receive weekly cutting edge tips, strategies, and news you need to grow your web business.
No charge. Unsubscribe anytime.