You are here

public function ImmutableInvalidationInterface::getState in Purge 8.3

Get the current or general state of the invalidation.

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.

Return value

int Any \Drupal\purge\Plugin\Purge\Invalidation\InvStatesInterface constant.

Throws

\LogicException Thrown state are stored that should not have been stored, as is not never supposed to happen catching this exception is not recommended.

1 method overrides ImmutableInvalidationInterface::getState()
ImmutableInvalidationBase::getState in src/Plugin/Purge/Invalidation/ImmutableInvalidationBase.php
Get the current or general state of the invalidation.

File

src/Plugin/Purge/Invalidation/ImmutableInvalidationInterface.php, line 87

Class

ImmutableInvalidationInterface
Describes the immutable invalidation.

Namespace

Drupal\purge\Plugin\Purge\Invalidation

Code

public function getState();