本文介绍了Apache的文件缓存的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何某些文件的阿帕奇处理缓存,并且是可以明确地说,某些文件应积极缓存比别人多,通过标准的配置文件给定主机或虚拟主机?

要把它放在上下文中,我把大量的网站内容在不同的XML文件,我想能够说,这个文件将被用到了很多,因此它缓存尽可能.. ?是否阿帕奇做这种事情智能化和动态..?它会观察哪些文件是比其他人更受欢迎,尝试匹配缓存命中适当..?

很多的一个问题,但基本的思路应该是足够清晰。

编辑:要清楚,这是加载和跨$ P $由PHP PTED这些资源文件 - 但PHP作为一个进程内阿帕奇催生..对不对?请帮助!


解决方案

  1. Apache是​​的只是 web服务器。它不知道具体的应用程序,所以它是你的应用程序的缓存结果的责任。

  2. 您可以使用应用程序不了解模块阿帕奇 - 。另外,请参阅例如在文章 。这个模块允许你指定什么应该被缓存,什么不应该被缓存。

  3. 此外,您还可以使用一些特定的PHP缓存机制,例如或的memcached

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 thing 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!

解决方案
  1. Apache is just a web-server. It doesn't know specific of your application, so it is responsibility of your application to cache results.
  2. 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.
  3. Also, you can use some PHP-specific caching mechanism, e.g. Alternative PHP Cache or memcached.

这篇关于Apache的文件缓存的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-19 08:30