final class CacheIndex
    implements Statement
    uses Snapshot
Public API: explicitly declared with @visibility public.

CACHE INDEX t [INDEX (…)], … IN {cache | DEFAULT}: a request to assign the indexes of MyISAM tables to a key cache.

Mirrors PT_cache_index_stmt and PT_cache_index_partitions_stmt. Rule: MYSQL-CACHE-INDEX-001. Each table resolves by MYSQL-SERVER-TABLES-001 and its resolution is the relation fact of its CachedTable; a table named twice is NonUniqueTable. A table with a partition selection is the only table of the statement. The key cache is a structured system variable name; DEFAULT names the default key cache. The server returns one row per table; its columns are MYSQL-ADMIN-ROWS-001. Source: https://dev.mysql.com/doc/refman/8.4/en/cache-index.html. Status: Implemented.

Assigning indexes to a key cachedoctest
$cache = (new \SqlSemantics\Platform\MySql\Semantics())->analyze('cache index t key (primary, i), u in hot');
    [$cache->toString(), $cache->statement->cache?->value] // => ['CACHE INDEX t INDEX (PRIMARY, i), u IN hot', 'hot']

Properties§

public list<CachedTable> $tables
public Name|null $cache

Methods§

public function __construct(list<CachedTable> $tables, public Name|null $cache)

Parameters

$tableslist<CachedTable>The tables in written order; at least one
$cacheName|nullThe key cache name; null for DEFAULT

Throws

InvalidConstruction When the list is empty, or a table with partitions is not the only one
Calls 4
public function deriveStatement(Derivation $derivation): void

Records the resolution of each table, reports a table named twice, and records the result rows.

Parameters

$derivationDerivation
Calls 4
public function render(Output $out): void

Writes the request.

Parameters

$outOutput
Calls 3

Test cases 1§

Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.

Dedicated tests 1

Relations§

Instantiated in 2