You are here

README.txt in Redis 7

Same filename and directory in other branches
  1. 7.3 README.txt
  2. 7.2 README.txt
Redis cache backends
====================

This package provides two different Redis cache backends. If you want to use
Redis as cache backend, you have to choose one of the two, but you cannot use
both at the same time. Well, it will be technically possible, but it would be
quite a dumb thing to do.

Predis
------

This implementation uses the Predis PHP library. It is compatible PHP 5.3
only, and need Redis >= 2.1.0 for using the WATCH command.

PhpRedis
--------

This implementation uses the PhpRedis PHP extention. In order to use it, you
will need to compile the extension yourself.

Redis version
-------------

Be careful with lock.inc replacement, actual implementation uses the Redis
WATCH command, it is actually there only since version 2.1.0. If you use
the it, it will just pass silently and work gracefully, but lock exclusive
mutex is exposed to race conditions.

Use Redis 2.1.0 or later if you can! I warned you.

Notes
-----

Both backends provide the exact same functionnalities. The major difference is
because PhpRedis uses a PHP extension, and not PHP code, it more performant.

Difference is not that visible, it's really a few millisec on my testing box.

Note that most of the settings are shared. See next sections.

Commong settings
================

Connect to a remote host
------------------------

If your Redis instance is remote, you can use this syntax:

  $conf['redis_client_host'] = '1.2.3.4';
  $conf['redis_client_port'] = 1234;

Port is optional, default used is 6379 (default Redis port).

Using a specific database
-------------------------

Per default, Redis ships the database "0". All default connections will be one
this one if nothing is specified.

Depending on you OS or OS distribution, you might have numerous database. To
use one in particular, just add to your settings.php file:

  $conf['redis_client_base'] = 12;

Lock backends
-------------

Both implementations provides a Redis lock backend. Lock backend, being used
with MySQL and Redis on the same backend is faster than default one, whatever
implementation you are using.

Both backends, thanks to the Redis WATCH, MULTI and EXEC commands provides a
real race condition free mutexes if you use Redis >= 2.1.0.

File

README.txt
View source
  1. Redis cache backends
  2. ====================
  3. This package provides two different Redis cache backends. If you want to use
  4. Redis as cache backend, you have to choose one of the two, but you cannot use
  5. both at the same time. Well, it will be technically possible, but it would be
  6. quite a dumb thing to do.
  7. Predis
  8. ------
  9. This implementation uses the Predis PHP library. It is compatible PHP 5.3
  10. only, and need Redis >= 2.1.0 for using the WATCH command.
  11. PhpRedis
  12. --------
  13. This implementation uses the PhpRedis PHP extention. In order to use it, you
  14. will need to compile the extension yourself.
  15. Redis version
  16. -------------
  17. Be careful with lock.inc replacement, actual implementation uses the Redis
  18. WATCH command, it is actually there only since version 2.1.0. If you use
  19. the it, it will just pass silently and work gracefully, but lock exclusive
  20. mutex is exposed to race conditions.
  21. Use Redis 2.1.0 or later if you can! I warned you.
  22. Notes
  23. -----
  24. Both backends provide the exact same functionnalities. The major difference is
  25. because PhpRedis uses a PHP extension, and not PHP code, it more performant.
  26. Difference is not that visible, it's really a few millisec on my testing box.
  27. Note that most of the settings are shared. See next sections.
  28. Commong settings
  29. ================
  30. Connect to a remote host
  31. ------------------------
  32. If your Redis instance is remote, you can use this syntax:
  33. $conf['redis_client_host'] = '1.2.3.4';
  34. $conf['redis_client_port'] = 1234;
  35. Port is optional, default used is 6379 (default Redis port).
  36. Using a specific database
  37. -------------------------
  38. Per default, Redis ships the database "0". All default connections will be one
  39. this one if nothing is specified.
  40. Depending on you OS or OS distribution, you might have numerous database. To
  41. use one in particular, just add to your settings.php file:
  42. $conf['redis_client_base'] = 12;
  43. Lock backends
  44. -------------
  45. Both implementations provides a Redis lock backend. Lock backend, being used
  46. with MySQL and Redis on the same backend is faster than default one, whatever
  47. implementation you are using.
  48. Both backends, thanks to the Redis WATCH, MULTI and EXEC commands provides a
  49. real race condition free mutexes if you use Redis >= 2.1.0.