Yii enables fragment caching, and yii enables fragment caching.
This article describes how Yii enables fragment caching. We will share this with you for your reference. The details are as follows:
1. Add the following components to the main. php file:
Cache '=> array ('class' => 'System. caching. cfilecache ',),
2. Add this sentence in view if cache is required
<? Php if ($ this-> beginCache ('aaa', array ('duration' => 3360, 'varybyparam' => array ('page '), 'desc' => array ('class' => 'System. caching. CDbCacheDependency ', 'sqll' => 'select count (server) from {game_serve}', // sets the dependency cache. If this statement changes, cache and new),) {// There is no cache here. The cache time is set above and the variable cache is set. If there is no paging, the last parameter is not required}?> // End the cache. if there is no cache, the information is cached at the end of the if statement. The information is cached in the runtime folder.