Fragment Caching
Fragment Caching
Fragment caching refers to caching a fragment of a Web page. For example, if a page displays a summary of yearly sale in a table, you can store this table in cache to eliminate the time needed to generate this table for each request. Fragment caching is built on top of data caching.
To use fragment caching, use the following construct in a view:
if ($this->beginCache($id)) { // ... generate content here ... $this->endCache(); }
That is, enclose content generation logic in a pair of beginCache() and 登录查看完整内容