Only days ago I started using browser caching, to cache js and css files and keep it ” Not Modified “, and it works very good.
Now I want to apply the same way on many pages of the system. For example, I have this page that lists the “users” from the database, and i want to cache the page not to over-load the database with queries.
My question is: is that even a good method (does the page still execute the db query when cached ?) or should I turn to disk caching or memcached ?
header("HTTP/1.1 304 Not Modified");
header("Expires: ".gmdate("D, d M Y H:i:s", time()+(60*86400))." GMT");
header("Cache-Control: must-revalidate");
mysql_query(" SELECT * FROM `users` ");
// list all users
A simple disk caching example, ive used this method when caching dynamic contant that dosent change often like stats, menus, rssfeeds, pages ect..