classCacheIndex
final class CacheIndex
implements Statement
uses Snapshot
@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.
$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> $tablespublic Name|null $cacheMethods§
public function __construct(list<CachedTable> $tables, public Name|null $cache)Parameters
$tables | list<CachedTable> | The tables in written order; at least one |
$cache | Name|null | The key cache name; null for DEFAULT |
Throws
InvalidConstruction When the list is empty, or a table with partitions is not the only oneCalls 4
- static-call Check::listOf() line 52
- class-const CachedTable::class() line 52
- static-call Check::input() line 54
- function-call
countline 54
public function deriveStatement(Derivation $derivation): voidRecords the resolution of each table, reports a table named twice, and records the result rows.
Parameters
$derivation | Derivation |
Calls 4
- method-call TableNames::record() line 67
- new TableNames line 67
- method-call AdminRows::admin() line 68
- new AdminRows line 68
public function render(Output $out): voidWrites the request.
Parameters
$out | Output |
Calls 3
- method-call Output::keyword() line 76
- method-call Output::name() line 80
- class-const NameUse::Identifier() line 80
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
- new SqlSemantics\Platform\MySql\Lowering\Server\Maintenance\KeyCacheRule::statement() packages/sql-semantics-mysql/src/Lowering/Server/Maintenance/KeyCacheRule.php:81
- new SqlSemantics\Platform\MySql\Lowering\Server\Maintenance\KeyCacheRule::statement() packages/sql-semantics-mysql/src/Lowering/Server/Maintenance/KeyCacheRule.php:85