\Drupal\strata\Capture\Classifier EphemeralScope

Decides whether one ephemeral key is captured, and whether a restore writes it back.

Two questions have to agree before an ephemeral key is recorded: is the realm captured at all, and is this particular key worth capturing. The first is a configuration switch and the second is a classification, and they live in different places for a reason - the switch is read on every mutation and must not touch the database, while the classification is stored and must. This is where the two meet.

On a site with no Redis this answers almost nothing, and that is correct. Drupal's default queue, semaphore, flood and session backends are TABLES, so the authoritative parts of the ephemeral keyspace are already captured through Realm::TABLE by the statement tap and the reconciler. Realm::EPHEMERAL exists for the case where a backend is not the database, which in practice means Redis. Capturing a database-backed queue twice - once as a table and once as an ephemeral key - would double its cost and give a restore two disagreeing copies.

Summary

Methods
Properties
Constants
__construct
captures
restores
classify
explain
No public properties found
No public constants found
No protected methods found
No protected properties found
No protected constants found
No private methods found
scope
classifications
No private constants found

Properties

$scope

$scope : \Drupal\strata\Capture\CaptureScope

Type

CaptureScope

$classifications

$classifications : \Drupal\strata\Capture\Classifier\ClassificationRegistry

Type

ClassificationRegistry

Methods

__construct()

__construct(\Drupal\strata\Capture\CaptureScope  $scope, \Drupal\strata\Capture\Classifier\ClassificationRegistry  $classifications) : mixed

Constructs a scope.

Parameters

\Drupal\strata\Capture\CaptureScope $scope

Whether the ephemeral realm is captured at all.

\Drupal\strata\Capture\Classifier\ClassificationRegistry $classifications

What each part of the keyspace has been decided to be.

Returns

mixed —

captures()

captures(string  $key) : bool

Whether an ephemeral key is captured.

Parameters

string $key

The key, such as "queue:aggregator_feeds" or "cache_render:foo".

Returns

bool —

TRUE when the realm is on and the key is not known to be derivable.

restores()

restores(string  $key) : bool

Whether a restore writes an ephemeral key back.

Stricter than capture on purpose. A key is stored when nothing has ruled it out, and written back only when something has ruled it in: writing an unrecognised ephemeral value over a live one during a restore is help nobody asked for, and the data it describes rebuilds it anyway.

Parameters

string $key

The key.

Returns

bool —

TRUE only when the key is classified authoritative.

classify()

classify(string  $key) : \Drupal\strata\Capture\Classifier\Classification

What a key is classified as.

Parameters

string $key

The key.

Returns

\Drupal\strata\Capture\Classifier\Classification —

The classification.

explain()

explain(string  $key) : string

Why a key is or is not captured, for the admin UI and a drush command.

Parameters

string $key

The key.

Returns

string —

A sentence naming the decision and where it came from.