README.Predis.txt 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637
  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 nrk/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';