<p>Is there a simple way to cache <code>MySQL queries</code> in <code>PHP</code> or failing that, is there a small class set that someone has written and made available that will do it? I can cache a whole page but that won't work as some data changes but some do not, I want to cache the part that does not.</p>

[{'answer_id': 37160, 'author': 'GateKiller', 'author_id': 383, 'author_profile': 'https://Stackoverflow.com/users/383', 'pm_score': 5, 'selected': True, 'text': '<p>This is a great overview of how to cache queries in MySQL:</p>\n\n<ul>\n<li><a href="http://www.petefreitag.com/item/390.cfm" rel="noreferrer">The MySQL Query Cache</a></li>\n</ul>\n'}, {'answer_id': 37363, 'author': 'lo_fye', 'author_id': 3407, 'author_profile': 'https://Stackoverflow.com/users/3407', 'pm_score': 1, 'selected': False, 'text': '<p>I think the query cache size is  0 by default, which is off.\nEdit your my.cnf file to give it at least a few megabytes.\nNo PHP changes necessary :)</p>\n'}, {'answer_id': 37575, 'author': 'ConroyP', 'author_id': 2287, 'author_profile': 'https://Stackoverflow.com/users/2287', 'pm_score': 1, 'selected': False, 'text': '<p>It may be complete overkill for what you\'re attempting, but have a look at <a href="http://eaccelerator.net/" rel="nofollow noreferrer">eAccelerator</a> or <a href="http://www.danga.com/memcached/" rel="nofollow noreferrer">memcache</a>. If you have queries that will change regularly and queries that won\'t, you may not want all of your db queries cached for the same length of time by mysql.</p>\n\n<p>Caching engines like the above allow you to decide, on a query-by-query basis, how long the data should be cached for. So say you\'ve data in your header that will change infrequently, you can check if it\'s currently in the cache - if so, return it, otherwise do the query, and put it into cache with a lifetime of N, so for the next N seconds every page load will pull the data from cache without going near MySQL.\nYou\'re then free to pull your other data "live" from the db as and when required, by-passing the cache.</p>\n'}, {'answer_id': 38079, 'author': 'Željko Živković', 'author_id': 1926, 'author_profile': 'https://Stackoverflow.com/users/1926', 'pm_score': 2, 'selected': False, 'text': '<p>You can use <a href="http://framework.zend.com/manual/en/zend.cache.html" rel="nofollow noreferrer">Zend Cache</a> to cache results of your queries among other things.</p>\n'}, {'answer_id': 1879478, 'author': 'buggedcom', 'author_id': 194480, 'author_profile': 'https://Stackoverflow.com/users/194480', 'pm_score': 0, 'selected': False, 'text': '<p>I would recommend the whole page caching route. If some of the data changes, simply place tokens/placeholders in place of the dynamic data. Cache the entire page with those tokens in place, then post process the tokens for the cached data for the tokens. Thus you now have a cached page that contains dynamic content.</p>\n'}]
['https://Stackoverflow.com/questions/37157', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1384652/']