/*
Name explanation
Sql_cache query Results cached (valid when query_cache_type=demand)
Sql_no_cache query results are not stored in cache
Query_cache_size indicates the size of the cache
Query_cache_type Query Cache session type (0=off close query cache 1=on on 2=demand manual via Sql_cache and Sql_no_cache control)
QUERY_CACHE_LIMIT Specifies the maximum query results that a single query can cache
Query_cache_min_res_unit the minimum cache block size allocated to the system, the default is 4KB, and the size of this value is directly related to the generation of fragmentation
Query_cache_wlock_invalidate on/OFF when the query table is locked, if the query hits the cache, is it possible to return the hit result directly
*/
/* Current Query cache configuration condition */
SHOW VARIABLES like '%query_cache% '
/*
Reset Query Cache */
RESET QUERY CACHE
/* Query Cache defragmentation */
FLUSH QUERY CACHE
/*
Current query Cache condition
Qcache_free_blocks: The number of contiguous memory blocks in the cache. A large number indicates that there may be fragmentation. FLUSH QUERY Cache organizes the fragments in the cache to get a free block.
Qcache_free_memory: Free memory in the cache.
Qcache_hits: Increases each time the query hits the cache
Qcache_inserts: Increases each time a query is inserted. The number of hits divided by the number of inserts is not the ratio.
Qcache_lowmem_prunes: The number of times that the cache is out of memory and must be cleaned up to provide space for more queries. This number is best seen over a long period of time, and if the number is growing, it can mean that fragmentation is very serious, or that there is little memory. (The above free_blocks and free_memory can tell you which kind of situation)
Qcache_not_cached: The number of queries that are not appropriate for caching, usually because these queries are not a SELECT statement or are using functions such as now ().
Qcache_queries_in_cache: The number of queries (and responses) that are currently cached.
Qcache_total_blocks: The number of blocks in the cache.
*/
SHOW STATUS like ' qcache% '
MySQL Query cache summary