classKeyCacheRule
final class KeyCacheRule
Lowers CACHE INDEX and LOAD INDEX INTO CACHE.
Rule: MYSQL-KEY-CACHE-001. Scope: keycache, keycache_list_or_parts, assign_to_keycache_parts, preload, preload_list_or_parts, preload_keys_parts, cache_keys_spec, cache_key_list_or_empty (5.6, 5.7), keycache_stmt, preload_stmt, opt_cache_key_list (8.0 and later), keycache_list, assign_to_keycache, key_cache_name, preload_list, preload_keys, adm_partition, opt_ignore_leaves. The index list goes through the query family's index rule, which reads PRIMARY as the primary key; the partitions through the table change family's partition list rule. KEY and INDEX are synonyms (LeafNoise). Constructs: CacheIndex, CachedTable, LoadIndex, PreloadedTable. Terminates: lists are flattened iteratively. Source: https://dev.mysql.com/doc/refman/8.4/en/cache-index.html, https://dev.mysql.com/doc/refman/8.4/en/load-index.html. Status: Implemented.
Methods§
public function __construct(private Lowering $lowering)Parameters
$lowering | Lowering | The lowering this rule belongs to |
Lowers a key cache statement.
Parameters
$form | Form |
Returns
Throws
ImplementationGap When a production has no ruleCalled from 1
Calls 8
- new CacheIndex line 81
- method-call KeyCacheRule::cached() line 82
- method-call KeyCacheRule::entries() line 82
- method-call Form::node() line 82
- method-call KeyCacheRule::cache() line 83
- new LoadIndex line 86
- method-call KeyCacheRule::preloaded() line 86
- static-call ImplementationGap::production() line 88
Answers the entry productions of an entry list, in written order.
Parameters
$list | Node |
Returns
list<Form>Called from 2
- method-call SqlSemantics\Platform\MySql\Lowering\Server\Maintenance\KeyCacheRule::statement() packages/sql-semantics-mysql/src/Lowering/Server/Maintenance/KeyCacheRule.php:82
- method-call SqlSemantics\Platform\MySql\Lowering\Server\Maintenance\KeyCacheRule::statement() packages/sql-semantics-mysql/src/Lowering/Server/Maintenance/KeyCacheRule.php:86
Calls 8
- method-call Lowering::form() line 102
- function-call
array_shiftline 102 - function-call
in_arrayline 103 - class-const KeyCacheRule::LISTS() line 103
- function-call
countline 107 - method-call Lists::items() line 107
- new Lists line 107
- function-call
array_unshiftline 108
public function cached(list<Form> $entries): list<CachedTable>Lowers the entries of CACHE INDEX.
Parameters
$entries | list<Form> |
Returns
list<CachedTable>Throws
ImplementationGap When a production has no ruleCalled from 2
- method-call SqlSemantics\Platform\MySql\Lowering\Server\Maintenance\KeyCacheRule::statement() packages/sql-semantics-mysql/src/Lowering/Server/Maintenance/KeyCacheRule.php:82
- method-call SqlSemantics\Platform\MySql\Lowering\Server\Maintenance\KeyCacheRule::statement() packages/sql-semantics-mysql/src/Lowering/Server/Maintenance/KeyCacheRule.php:85
Calls 2
- method-call KeyCacheRule::entry() line 125
- new CachedTable line 126
public function preloaded(list<Form> $entries): list<PreloadedTable>Lowers the entries of LOAD INDEX INTO CACHE.
Parameters
$entries | list<Form> |
Returns
list<PreloadedTable>Throws
ImplementationGap When a production has no ruleCalled from 2
- method-call SqlSemantics\Platform\MySql\Lowering\Server\Maintenance\KeyCacheRule::statement() packages/sql-semantics-mysql/src/Lowering/Server/Maintenance/KeyCacheRule.php:86
- method-call SqlSemantics\Platform\MySql\Lowering\Server\Maintenance\KeyCacheRule::statement() packages/sql-semantics-mysql/src/Lowering/Server/Maintenance/KeyCacheRule.php:87
Calls 2
- method-call KeyCacheRule::entry() line 143
- new PreloadedTable line 144
public function entry(Form $form): array{QualifiedName, PartitionSelection|null, list<Name|PrimaryIndex>|null, bool}Lowers the table, the partitions, the index list and IGNORE LEAVES of one entry.
Parameters
$form | Form |
Returns
array{QualifiedName, PartitionSelection|null, list<Name|PrimaryIndex>|null, bool}Throws
ImplementationGap When a production has no ruleCalled from 2
- method-call SqlSemantics\Platform\MySql\Lowering\Server\Maintenance\KeyCacheRule::cached() packages/sql-semantics-mysql/src/Lowering/Server/Maintenance/KeyCacheRule.php:125
- method-call SqlSemantics\Platform\MySql\Lowering\Server\Maintenance\KeyCacheRule::preloaded() packages/sql-semantics-mysql/src/Lowering/Server/Maintenance/KeyCacheRule.php:143
Calls 6
- class-const KeyCacheRule::ENTRIES() line 158
- static-call ImplementationGap::production() line 158
- method-call Form::node() line 161
- method-call KeyCacheRule::partitions() line 162
- method-call KeyCacheRule::indexes() line 163
- method-call KeyCacheRule::leaves() line 164
public function partitions(Node $partition): PartitionSelectionLowers a partition selection: a node of adm_partition.
Parameters
$partition | Node |
Returns
Throws
ImplementationGap When a production has no ruleCalled from 1
Calls 3
- method-call Lowering::form() line 175
- method-call KeyCacheRule::marked() line 178
- static-call ImplementationGap::production() line 180
public function marked(Form $form): PartitionSelectionLowers the 5.x partition selection that holds the have_partitioning marker.
Parameters
$form | Form |
Returns
Throws
ImplementationGap When a production has no ruleCalled from 1
Calls 1
- method-call Form::node() line 191
public function indexes(Node $list): list<Name|PrimaryIndex>|nullLowers an optional index list: a node of cache_keys_spec or opt_cache_key_list; an absent list is null.
Parameters
$list | Node |
Returns
list<Name|PrimaryIndex>|nullThrows
ImplementationGap When a production has no ruleCalled from 1
Calls 3
- method-call Lowering::form() line 204
- method-call KeyCacheRule::keys() line 211
- static-call ImplementationGap::production() line 212
public function keys(Form $form): list<Name|PrimaryIndex>Lowers a written index list.
Parameters
$form | Form |
Returns
list<Name|PrimaryIndex>Throws
ImplementationGap When a production has no ruleCalled from 1
Calls 1
- method-call Form::node() line 224
public function leaves(Node $leaves): boolLowers IGNORE LEAVES: a node of opt_ignore_leaves.
Parameters
$leaves | Node |
Returns
boolThrows
ImplementationGap When a production has no ruleCalled from 1
Calls 2
- method-call Lowering::form() line 236
- static-call ImplementationGap::production() line 241
Lowers the key cache name: a node of key_cache_name; DEFAULT is null.
Parameters
$name | Node |
Returns
?NameThrows
ImplementationGap When a production has no ruleCalled from 2
- method-call SqlSemantics\Platform\MySql\Lowering\Server\Maintenance\KeyCacheRule::statement() packages/sql-semantics-mysql/src/Lowering/Server/Maintenance/KeyCacheRule.php:83
- method-call SqlSemantics\Platform\MySql\Lowering\Server\Maintenance\KeyCacheRule::statement() packages/sql-semantics-mysql/src/Lowering/Server/Maintenance/KeyCacheRule.php:85
Calls 2
- method-call Lowering::form() line 252
- static-call ImplementationGap::production() line 257
Private surface 3§
Implementation details, listed for orientation only.
private const ENTRIES = ['assign_to_keycache: table_ident cache_keys_spec' => [0, null, 1, null], 'assi…private const LISTS = ['keycache_list_or_parts: keycache_list', 'keycache_list_or_parts: assign_to_ke…private Lowering $loweringTest cases 1§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 1
KeyCacheRuleTestcalls