function MemoryBackend::clearByPrefix
Makes the flood control mechanism forget an event by identifier prefix.
Parameters
string $name: The name of an event.
string $prefix: The prefix of the identifier to be cleared.
Overrides PrefixFloodInterface::clearByPrefix
File
- 
              core/
lib/ Drupal/ Core/ Flood/ MemoryBackend.php, line 60  
Class
- MemoryBackend
 - Defines the memory flood backend. This is used for testing.
 
Namespace
Drupal\Core\FloodCode
public function clearByPrefix(string $name, string $prefix) : void {
  foreach ($this->events as $event_name => $identifier) {
    $identifier_key = key($identifier);
    $identifier_parts = explode("-", $identifier_key);
    $identifier_prefix = reset($identifier_parts);
    if ($prefix == $identifier_prefix && $name == $event_name) {
      unset($this->events[$event_name][$identifier_key]);
    }
  }
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.