function FloodInterface::register

Same name in other branches
  1. 9 core/lib/Drupal/Core/Flood/FloodInterface.php \Drupal\Core\Flood\FloodInterface::register()
  2. 8.9.x core/lib/Drupal/Core/Flood/FloodInterface.php \Drupal\Core\Flood\FloodInterface::register()
  3. 10 core/lib/Drupal/Core/Flood/FloodInterface.php \Drupal\Core\Flood\FloodInterface::register()

Registers an event for the current visitor to the flood control mechanism.

Parameters

string $name: The name of an event. To prevent unintended name clashes, it is recommended to use the module name first in the event name, optionally followed by a dot and the actual event name (e.g. "my_module.my_event").

int $window: (optional) Number of seconds before this event expires. Defaults to 3600 (1 hour). Typically uses the same value as the isAllowed() $window parameter. Expired events are purged on cron run to prevent the flood table from growing indefinitely.

string $identifier: (optional) Unique identifier of the current user. Defaults to the current user's IP address. The identifier can be given an additional prefix separated by "-". Flood backends may then optionally implement the PrefixFloodInterface which allows all flood events that share the same prefix to be cleared simultaneously.

2 methods override FloodInterface::register()
DatabaseBackend::register in core/lib/Drupal/Core/Flood/DatabaseBackend.php
Registers an event for the current visitor to the flood control mechanism.
MemoryBackend::register in core/lib/Drupal/Core/Flood/MemoryBackend.php
Registers an event for the current visitor to the flood control mechanism.

File

core/lib/Drupal/Core/Flood/FloodInterface.php, line 29

Class

FloodInterface
Defines an interface for flood controllers.

Namespace

Drupal\Core\Flood

Code

public function register($name, $window = 3600, $identifier = NULL);

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.