You are here

public function ImmutableInvalidation::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.

Overrides ImmutableInvalidationBase::getState

File

src/Plugin/Purge/Invalidation/ImmutableInvalidation.php, line 65

Class

ImmutableInvalidation
Provides the immutable invalidation object.

Namespace

Drupal\purge\Plugin\Purge\Invalidation

Code

public function getState() {
  return $this->invalidation
    ->getState();
}