how to measure query cache by queries ?

Recently I build and install special plugin from this source http://rpbouman.blogspot.com/2008/07/inspect-query-cahce-usi ng-mysql.html#links

This seems to work fine (need some trivial code hacking for my 5.1.37 version, can share if anybody need it).

desc MYSQL_CACHED_QUERIES;±------------------------±------------±-----±----±--------±------+| Field | Type | Null | Key | Default | Extra |±------------------------±------------±-----±----±--------±------+| STATEMENT_ID | int(21) | NO | | 0 | || SCHEMA_NAME | varchar(64) | NO | | | || STATEMENT_TEXT | longtext | NO | | NULL | || RESULT_BLOCKS_COUNT | int(21) | NO | | 0 | || RESULT_BLOCKS_SIZE | bigint(21) | NO | | 0 | || RESULT_BLOCKS_SIZE_USED | bigint(21) | NO | | 0 | |±------------------------±------------±-----±----±--------±------+

but if mysql query cache really use LRU http://en.wikipedia.org/wiki/Cache_algorithms#Least_Recently _Used algorithm (there are many sources in internet with this opinion), there must be hits counter or age value or linked list order must be moving frequently .
But it doesn’t : you can select without order and see stable orded. you can produce query hit many times, but nothing changes.

I think mysql use “Least Recently Inserted” algorithm. Am I right?

So I have questions:

Does mysql really use LRU strategy for query cache ?
Is existing realization good enough for general use ?
Any other realization of query cache available in public ?

I think you’re right, but I don’t remember the code very well. However, the code has a novel’s worth of comments at the top of the file. It should be easy for you to inspect and see. Post back whatever you learn!

ok, i move forward a bit :

  1. yes, LRU really used by mysql query cache. every block move at top of linked list when cache hit. But this plugin cycle other data structure - query hash. So, for analyze hits I need wrote another plugin code. This is not good.

  2. Many people think than query cache is a performance break. They even make joke site ( [URL]http://mituzas.lt/2009/07/08/query-cache-tuning/[/URL]).
    Why ? My mysql installations are not concurrent enough and I couldn’t confirm this “joke”. if I turn of cache, this cause increasing small amount of cpu time.

  3. still no other implementation of cache…