\Drupal\strata\Tier MemoryPlacementIndex

A placement index that lives for one process.

What the unit lane routes against, and what a one-shot command can use when it has no database. The database index is the one a site runs on.

Summary

Methods
Properties
Constants
get
record
place
displace
forget
keysIn
page
clear
byTier
statistics
No public properties found
No public constants found
No protected methods found
No protected properties found
No protected constants found
sorted
placements
No private constants found

Properties

$placements

$placements : array

Placements, keyed by object key.

Type

array<string, Placement> —

Methods

get()

get(string  $key) : \Drupal\strata\Tier\Placement|null

Where one object is.

Parameters

string $key

The object key.

Returns

\Drupal\strata\Tier\Placement|null —

The placement, or NULL when nothing has been recorded for that key. NULL means unknown, not absent; Placement::isEmpty() is what says every tier was asked and none had it.

record()

record(\Drupal\strata\Tier\Placement  $placement) : \Drupal\strata\Tier\Placement

Replaces what is known about one object.

Parameters

\Drupal\strata\Tier\Placement $placement

The placement. Tiers not named by it are removed, so this is how a rebuild writes an authoritative answer over a stale one.

Returns

\Drupal\strata\Tier\Placement —

The stored placement.

place()

place(string  $key, int  $tier, int  $bytes = 0) : \Drupal\strata\Tier\Placement

Adds one tier to what is known about an object.

Parameters

string $key

The object key.

int $tier

Tier index that holds it.

int $bytes

The object's size, or zero to keep whatever is recorded.

Returns

\Drupal\strata\Tier\Placement —

The resulting placement.

displace()

displace(string  $key, int  $tier) : \Drupal\strata\Tier\Placement

Removes one tier from what is known about an object.

Parameters

string $key

The object key.

int $tier

Tier index that no longer holds it.

Returns

\Drupal\strata\Tier\Placement —

The resulting placement, empty when that was the last tier holding it.

forget()

forget(array  $keys) : int

Forgets objects entirely.

Parameters

array $keys

Object keys.

Returns

int —

How many rows were removed.

keysIn()

keysIn(int  $tier, int  $limit = 1000, int  $offset = 0) : list<string>

Object keys one tier holds, in key order.

Parameters

int $tier

Tier index.

int $limit

Most keys to return.

int $offset

Keys to skip.

Returns

list

The keys.

page()

page(int  $limit = 1000, int  $offset = 0) : list<\Drupal\strata\Tier\Placement>

One page of every placement, in key order.

Parameters

int $limit

Most placements to return.

int $offset

Placements to skip.

Returns

list<\Drupal\strata\Tier\Placement> —

The page, empty once the offset is past the end.

clear()

clear() : int

Drops every row.

Returns

int —

How many rows were removed.

byTier()

byTier() : array<int,array{objects: int, bytes: int}>

What each tier holds.

Returns

array

Tier index keyed to how many objects it holds and how many bytes they occupy. A tier with nothing recorded is absent, so a report drawn from this shows the tiers in use.

statistics()

statistics() : array{objects: int, copies: int, bytes: int}

How many distinct objects and rows are held.

Returns

array{objects: int, copies: int, bytes: int} —

Distinct object keys, total placements across every tier, and the byte total counted once per object rather than once per copy.

sorted()

sorted() : list<\Drupal\strata\Tier\Placement>

Every placement in key order.

Returns

list<\Drupal\strata\Tier\Placement> —

The placements.