0

I am trying to implement MOD_DISK_CACHE. Is it possible to cache only the static contents of a page containing both static and dynamic content?

i.e, if I want to cache the homepage of a user profile, I just want to cache the static contents of that page which will be common/generic to all the users, while the dynamic contents for eg "Welcome <Username>!!!", which is different for different users should be handled separately.

Any pointers would be so helpful.

4

1 回答 1

0

我根本不希望mod_disk_cache对动态内容(例如 PHP)进行操作。那不是您要缓存的磁盘内容。动态内容是在 Apache 之外生成的(对于 PHP,由 PHP 解释器生成)。

要对这些页面进行 HTTP 缓存,您需要有类似 Varnish(真正的 HTTP 缓存)之类的东西,它位于访问者和服务器之间。它为您缓存所有内容,包括动态内容。使用正确的Expires,VaryCache-Control标头,您可以避免某些页面被缓存(例如管理页面)。

Varnish 还支持特殊的“edge side include”之类的标签;<esi:include>. 这些仍然允许您在缓存页面中拥有动态部分。

于 2011-09-06T09:30:26.340 回答