How does apache handle caching of certain files, and is it possible to explicitly say that certain files should be aggressively cached more than others, through the standard config files for a given host or virtualhost?
To put it in context, I keep a lot of site content in various XML files, and I'd like to be able to say that this file will be used a lot, and therefore cache it as much as possible..? Does apache do this kind of thin开发者_开发百科g intelligently and on the fly..? Will it observe which files are more popular than others and try to match cache hits appropriately..?
Lots of questions in one, but the basic idea should be clear enough.
edit: to be clear, these are resource files which are loaded and interpreted by PHP - but php as a process is spawned inside apache.. right? Please help!
- Apache is just a web-server. It doesn't know specific of your application, so it is responsibility of your application to cache results.
- You can use application unaware module in apache - mod_cache. Also, see example of configuration in article Caching Dynamic Content with Apache httpd. This module allows you to specify what should be cached and what shouldn't be cached.
- Also, you can use some PHP-specific caching mechanism, e.g. Alternative PHP Cache or memcached.
If you are serving the XML files directly from Apache, with no intervening CGI scripts or language module such as PHP, then you should look at mod_file_cache. From your description, I think it's what you're looking for.
精彩评论