0

I'm very new to the concept "caching", so excuse me if my question is too simple.
So,I'm using Codeigniter(PHP framework) and it supports page caching, simply by doing this $this->output->cache(n)//n: number of minutes to remain cached
(I think) Codeigniter's caching will store any requested page in a cache file, and get the page when needed immediately.
Also there's a 3rd part web application called Vanish Cache, it sits between Apache and the client, then it will cache requested pages and re-send them again when needed, isn't that the same thing Codeigniter does, or is it different from that?
Wouldn't it be a waste to cache each page twice, by Codeigniter and Vanish?

assuming they do the exact same thing(cache pages and re-send them to the user),which one is more efficient for dynamic(database driver) websites?

4

1 回答 1

0

从表面上看,它们做同样的事情,但是不同级别的缓存有适当的用途。

像 Varnish 这样位于 Web 服务器和应用程序之间的缓存提供了非常高的性能。您可以将它用于 CSS 等静态内容、静态页面和很少更改的动态内容。

应用程序缓存提供了一个性能较差但灵活得多的选项。通常您可以按时间缓存,也可以按“当前用户”等应用程序/请求变量进行缓存。这允许您提供具有更多精细控制的状态相关缓存。例如,您可以根据对象在数据库中的最后修改时间来缓存对象的详细信息页面。

于 2012-06-19T01:12:20.300 回答