You are here

public function InvalidationsService::getImmutable in Purge 8.3

Create a new immutable invalidation object of the given type.

Parameters

string $plugin_id: The id of the invalidation type being instantiated.

mixed|null $expression: Value - usually string - that describes the kind of invalidation, NULL when the type of invalidation doesn't require $expression. Types usually validate the given expression and throw exceptions for bad input.

Return value

\Drupal\purge\Plugin\Purge\Invalidation\ImmutableInvalidationInterface The immutable invalidation object.

Throws

\Drupal\purge\Plugin\Purge\Invalidation\Exception\MissingExpressionException Thrown when plugin defined expression_required = TRUE and when it is instantiated without expression (NULL).

\Drupal\purge\Plugin\Purge\Invalidation\Exception\InvalidExpressionException Exception thrown when plugin got instantiated with an expression that is not deemed valid for the type of invalidation.

Overrides InvalidationsServiceInterface::getImmutable

File

src/Plugin/Purge/Invalidation/InvalidationsService.php, line 93

Class

InvalidationsService
Provides a service that instantiates invalidation objects on-demand.

Namespace

Drupal\purge\Plugin\Purge\Invalidation

Code

public function getImmutable($plugin_id, $expression = NULL) {
  $id = $this->instanceCounterImmutables--;
  return new ImmutableInvalidation($this
    ->createInstance($plugin_id, $expression, $id));
}