You are here

README.Predis.txt in Redis 8

Same filename and directory in other branches
  1. 7.3 README.Predis.txt
  2. 7 README.Predis.txt
  3. 7.2 README.Predis.txt
Predis cache backend
====================

Using Predis for the Drupal 8 version of this module is still experimental.

Get Predis
----------

Predis can be installed to the vendor directory using composer like so:

composer require predis/predis


Configuration of module for use with Predis
----------------------------

There is not much different to configure about Predis.
Adding this to settings.php should suffice for basic usage:

$settings['redis.connection']['interface'] = 'Predis';
$settings['redis.connection']['host']      = '1.2.3.4';  // Your Redis instance hostname.
$settings['cache']['default'] = 'cache.backend.redis';

To add more magic with a primary/replica setup you can use a config like this:

$settings['redis.connection']['interface'] = 'Predis'; // Use predis library.
$settings['redis.connection']['replication'] = TRUE; // Turns on replication.
$settings['redis.connection']['replication.host'][1]['host'] = '1.2.3.4';  // Your Redis instance hostname.
$settings['redis.connection']['replication.host'][1]['port'] = '6379'; // Only required if using non-standard port.
$settings['redis.connection']['replication.host'][1]['role'] = 'primary'; // The redis instance role.
$settings['redis.connection']['replication.host'][2]['host'] = '1.2.3.5';
$settings['redis.connection']['replication.host'][2]['port'] = '6379';
$settings['redis.connection']['replication.host'][2]['role'] = 'replica';
$settings['redis.connection']['replication.host'][3]['host'] = '1.2.3.6';
$settings['redis.connection']['replication.host'][3]['port'] = '6379';
$settings['redis.connection']['replication.host'][3]['role'] = 'replica';
$settings['cache']['default'] = 'cache.backend.redis';

File

README.Predis.txt
View source
  1. Predis cache backend
  2. ====================
  3. Using Predis for the Drupal 8 version of this module is still experimental.
  4. Get Predis
  5. ----------
  6. Predis can be installed to the vendor directory using composer like so:
  7. composer require predis/predis
  8. Configuration of module for use with Predis
  9. ----------------------------
  10. There is not much different to configure about Predis.
  11. Adding this to settings.php should suffice for basic usage:
  12. $settings['redis.connection']['interface'] = 'Predis';
  13. $settings['redis.connection']['host'] = '1.2.3.4'; // Your Redis instance hostname.
  14. $settings['cache']['default'] = 'cache.backend.redis';
  15. To add more magic with a primary/replica setup you can use a config like this:
  16. $settings['redis.connection']['interface'] = 'Predis'; // Use predis library.
  17. $settings['redis.connection']['replication'] = TRUE; // Turns on replication.
  18. $settings['redis.connection']['replication.host'][1]['host'] = '1.2.3.4'; // Your Redis instance hostname.
  19. $settings['redis.connection']['replication.host'][1]['port'] = '6379'; // Only required if using non-standard port.
  20. $settings['redis.connection']['replication.host'][1]['role'] = 'primary'; // The redis instance role.
  21. $settings['redis.connection']['replication.host'][2]['host'] = '1.2.3.5';
  22. $settings['redis.connection']['replication.host'][2]['port'] = '6379';
  23. $settings['redis.connection']['replication.host'][2]['role'] = 'replica';
  24. $settings['redis.connection']['replication.host'][3]['host'] = '1.2.3.6';
  25. $settings['redis.connection']['replication.host'][3]['port'] = '6379';
  26. $settings['redis.connection']['replication.host'][3]['role'] = 'replica';
  27. $settings['cache']['default'] = 'cache.backend.redis';