public function MongodbFlood::register in MongoDB 8
Implements Drupal\Core\Flood\FloodInterface::register().
Overrides FloodInterface::register
File
- src/
MongodbFlood.php, line 45 - Definition of Drupal\mongodb\MongodbFlood.
Class
- MongodbFlood
- Defines the mongodb flood backend.
Namespace
Drupal\mongodbCode
public function register($name, $window = 3600, $identifier = NULL) {
if (!isset($identifier)) {
$identifier = $this
->request()
->getClientIp();
}
$data = array(
'event' => $name,
'identifier' => $identifier,
'timestamp' => REQUEST_TIME,
'expiration' => REQUEST_TIME + $window,
);
$this->mongo
->get('flood')
->insert($data);
}