Change record status: 
Project: 
Introduced in branch: 
2.x
Introduced in version: 
2.0.0-alpha1
Description: 

Previously, all alternative services like cache, queue, lock and flood had classes for each supported client (PhpRedis, Predis, Relay). Factories dynamically created the specific class.

This resulted in a lot of duplication, bugs and different implementations.

Instead, there is now only a single class for those and instead, the abstraction is on the ClientInterface, which is an adapter for the actual client object that unifies client specific behavior.

Support client adapters are no longer hardcoded, it is possible to provide a client factory as a tagged service:

  redis.factory.phpredis:
    class: Drupal\redis\Client\PhpRedisFactory
    tags:
      - { name: redis_client_factory, priority: 20 }

Factories now receive all settings as an array. This allows to support new settings without API changes and refactorings.

As before, a specific client can be configured in settings.php based on the, alternatively, it will pick up the first supported one based on the priority.

To simplify bootstrap container setup, the default factories are hardcoded as a fallback, but it is possible to set up a custom factory service.

Impacts: 
Site builders, administrators, editors
Module developers