public function InvalidationInterface::setStateContext in Purge 8.3
Set (or reset) state context to the purger instance next in line.
New, freshly claimed invalidations and those exiting the PurgersService always have NULL as their state context. This means that when called, ::getState() resolves the general state by triaging all stored states. So for example: when no states are known, it will evaluate to FRESH but when one state is set to SUCCEEDED and a few others to FAILED, the general state becomes FAILED. When only SUCCEEDED's is stored, it will evaluate as such.
However, the behaviors of ::getState() and ::setState() change after a call to ::setStateContext(). From this point on, both will respectively retrieve and store the state *specific* to that purger context. Context switching is handled by PurgersServiceInterface::invalidate() and therefore no understanding of this concept is required outside the purgers service code.
Parameters
string|null $purger_instance_id: The instance ID of the purger that is about to process the object, or NULL when no longer any purgers are processing it. NULL is the default.
Throws
\LogicException Thrown when the given parameter is empty, not a string or NULL.
\Drupal\purge\Plugin\Purge\Purger\Exception\BadPluginBehaviorException Thrown when the last set state was not any of:
- InvStatesInterface::SUCCEEDED
- InvStatesInterface::FAILED
- InvStatesInterface::PROCESSING
- InvStatesInterface::NOT_SUPPORTED.
See also
\Drupal\purge\Plugin\Purge\Purger\PurgersServiceInterface::invalidate()
\Drupal\purge\Plugin\Purge\Invalidation\InvalidationInterface::setState()
\Drupal\purge\Plugin\Purge\Invalidation\ImmutableInvalidationInterface::getState()
1 method overrides InvalidationInterface::setStateContext()
- InvalidationBase::setStateContext in src/
Plugin/ Purge/ Invalidation/ InvalidationBase.php - Set (or reset) state context to the purger instance next in line.
File
- src/
Plugin/ Purge/ Invalidation/ InvalidationInterface.php, line 125
Class
- InvalidationInterface
- Desribes the invalidation object.
Namespace
Drupal\purge\Plugin\Purge\InvalidationCode
public function setStateContext($purger_instance_id);