function DatabaseBackend::clearByPrefix

Same name and namespace in other branches
  1. 10 core/lib/Drupal/Core/Flood/DatabaseBackend.php \Drupal\Core\Flood\DatabaseBackend::clearByPrefix()

Overrides PrefixFloodInterface::clearByPrefix

File

core/lib/Drupal/Core/Flood/DatabaseBackend.php, line 104

Class

DatabaseBackend
Defines the database flood backend. This is the default Drupal backend.

Namespace

Drupal\Core\Flood

Code

public function clearByPrefix(string $name, string $prefix) : void {
    try {
        $this->connection
            ->delete(static::TABLE_NAME)
            ->condition('event', $name)
            ->condition('identifier', $prefix . '-%', 'LIKE')
            ->execute();
    } catch (\Exception $e) {
        $this->catchException($e);
    }
}

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