Question: Is it a reasonable/responsible idea to store a database result set in the user's session, as opposed to loading it fresh from the database on every page load? I am aware of the availability of caching the generated HTML code in a cache file on the server but that has too many convenience issues in my opinion.

For example, on a shopping page, the brands tab in the main nav has a drop down menu that lists all the brands that currently have products on the site. The query is optimized but it would still have to run at every page load. Instead of doing that I would like to save the result set in the user's session, thus only loading the brands once per session.

Alternatively, I could generate the HTML code for the subnav and store it in a cache file on the server. If the idea of storing the array in the session isn't beneficial to the server's performance, I might be able to see past the convenience issues.

Thanks for all the help!

Answer: 
I would suggest go for [Memcached](http://memcached.org/ "Memcached") in this case. 

![enter image description here](https://i.stack.imgur.com/SgxTb.png)

Instructions for setup & configuration can be found here: <https://www.digitalocean.com/community/articles/how-to-install-and-use-memcache-on-ubuntu-12-04> (Please note this one is for Ubuntu but it will give you good idea)
Others adviced to use Memcached. It adds complexity and requires RAM (so it makes MySQL MUCH MUCH MUCH slower if they run on the same server). It's possible that it's the best solution for you, but since I don't know any solution which is "good for everyone", and since I don't know your workload, I just suggest alternatives.

Yes, MySQL query cache has many issues. But it may be good for you.

MEMORY tables could be a good solution too, if you don't have too much stuff to cache.

Storing a cache in session data is probably worse than not caching at all, because data are duplicate for every user, and cleanup occurse only when sessions expire. Don't waste your memory that way.