\Drupal\strata\Tier Tier

One rung of the storage ladder: a bucket, an age band, and whether the copy below it survives.

Tier zero is where every write lands and where every ref lives. A tier above it holds history that has aged past its own threshold, and the only question that then matters is whether the nearer copy is kept:

  • retainBelow true makes the tier a replica. The nearer copy stays, so the near tier remains complete and the far tier is a second copy of the same object under the same key. This is the layered-safety configuration, and it is the one to use when several sites share a bucket.
  • retainBelow false makes the tier a destination. The object moves, so history ends up split across buckets and a read of that part of history reaches the far tier. This is the cheap configuration: the object is stored once.

Neither changes an object's address. A tier is where a key lives, never part of the key, so the same frame in two tiers is one object rather than a copy with a new name.

Summary

Methods
Properties
Constants
__construct
isNearest
name
accepts
fromSettings
jsonSerialize
index
target
fromAge
retainBelow
No public constants found
No protected methods found
No protected properties found
No protected constants found
No private methods found
No private properties found
No private constants found

Properties

$index

$index : int

Type

int

$target

$target : \Drupal\strata\Tier\TierTarget

Type

TierTarget

$fromAge

$fromAge : int

Type

int

$retainBelow

$retainBelow : bool

Type

bool

Methods

__construct()

__construct(int  $index, \Drupal\strata\Tier\TierTarget  $target, int  $fromAge = 0, bool  $retainBelow = false) : mixed

Constructs a tier.

Parameters

int $index

Position on the ladder, zero being the nearest.

\Drupal\strata\Tier\TierTarget $target

Where this tier writes.

int $fromAge

Seconds an object must have gone untouched before it belongs here. Zero for the nearest tier, which holds everything by definition.

bool $retainBelow

TRUE to keep the copy in the tier below, making this a replica rather than a destination.

Throws

\InvalidArgumentException

When the index or the age is negative, or the nearest tier is given a non-zero age.

Returns

mixed —

isNearest()

isNearest() : bool

Whether this is the tier writes land in.

Returns

bool —

TRUE for tier zero.

name()

name() : string

This tier's name.

Returns

string —

The target's name, which is also what per-tier request counts are filed under.

accepts()

accepts(int  $age) : bool

Whether an object of a given age has aged into this tier.

Says nothing about whether a colder tier also claims it; TierMap::forAge() answers that by taking the coldest tier that says yes.

Parameters

int $age

Seconds since the object was last written.

Returns

bool —

TRUE when the age has reached this tier's threshold.

fromSettings()

fromSettings(array  $row, int  $index) : self

Builds a tier from one settings row.

Parameters

array $row

One entry of the tiers.levels setting.

int $index

Position on the ladder.

Throws

\InvalidArgumentException

When the row names no provider, or gives the nearest tier an age threshold.

Returns

self —

The tier.

jsonSerialize()

jsonSerialize() : array<string,mixed>

{@inheritdoc}

Returns

array

The tier as a plain array for a report table.