Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to check MySQL cache lifetime?

Tags:

mysql

lifetime

Normally, MySQL clears the cache automatically, when the tables are modified.

If there is any other query time limit which determine the lifetime, or generated cache could live for years, if the are no modifications ?

like image 635
Fedir RYKHTIK Avatar asked Nov 18 '11 14:11

Fedir RYKHTIK


1 Answers

No, there is no TTL expiration policy for the MySQL query cache.

Of course all entries in the query cache go away when you restart the MySQL daemon.

And you can purge the query cache with RESET QUERY CACHE.

If you need greater control over caching, you should probably use Memcached or some similar dedicating caching technology that you access directly from your application code. In fact, more and more often I recommend to disable the MySQL query cache completely.

like image 64
Bill Karwin Avatar answered Oct 14 '22 07:10

Bill Karwin