You are here

class FloodFactory in Redis 8

Flood backend singleton handling.

Hierarchy

Expanded class hierarchy of FloodFactory

1 string reference to 'FloodFactory'
redis.services.yml in ./redis.services.yml
redis.services.yml
1 service uses FloodFactory
redis.flood.factory in ./redis.services.yml
Drupal\redis\Flood\FloodFactory

File

src/Flood/FloodFactory.php, line 11

Namespace

Drupal\redis\Flood
View source
class FloodFactory {

  /**
   * @var \Drupal\redis\ClientInterface
   */
  protected $clientFactory;

  /**
   * The request stack.
   *
   * @var \Symfony\Component\HttpFoundation\RequestStack
   */
  protected $requestStack;

  /**
   * Construct the PhpRedis flood backend factory.
   *
   * @param \Drupal\redis\ClientFactory $client_factory
   *   The database connection which will be used to store the flood event
   *   information.
   * @param \Symfony\Component\HttpFoundation\RequestStack $request_stack
   *   The request stack used to retrieve the current request.
   */
  public function __construct(ClientFactory $client_factory, RequestStack $request_stack) {
    $this->clientFactory = $client_factory;
    $this->requestStack = $request_stack;
  }

  /**
   * Get actual flood backend.
   *
   * @return \Drupal\Core\Flood\FloodInterface
   *   Return flood instance.
   */
  public function get() {
    $class_name = $this->clientFactory
      ->getClass(ClientFactory::REDIS_IMPL_FLOOD);
    return new $class_name($this->clientFactory, $this->requestStack);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
FloodFactory::$clientFactory protected property
FloodFactory::$requestStack protected property The request stack.
FloodFactory::get public function Get actual flood backend.
FloodFactory::__construct public function Construct the PhpRedis flood backend factory.