You can do more elaborate grouping by the setting up cache_id groups. This is accomplished by separating each sub-group with a vertical bar ' | ' in the CACHE_ID value. You can have as many sub-groups as.
Example 14-9. CACHE_ID groups
The code is as follows |
Copy Code |
Require (' Smarty.class.php '); $smarty = new Smarty; $smarty->caching = true; |
Clear all caches with "Sports|basketball" as the two cache_id groups
The code is as follows |
Copy Code |
$smarty->clear_cache (null, "Sports|basketball"); |
Clear all caches with "sports" as the "the"-cache_id group. This would
Include "Sports|basketball", or "sports| (anything) | (anything) | (anything) |
The code is as follows |
Copy Code |
$smarty->clear_cache (NULL, "Sports"); $smarty->display (' Index.tpl ', "Sports|basketball"); |
When I do not know how to clear the Smarty with the ID of the cache, found in the manual described above, but the English is too bad, unintelligible.
In csdn to find netizens posts, after reading the epiphany.
That's when you cache pages like this:
The code is as follows |
Copy Code |
$smarty-> display (' Basic.tpl ', "groupxxx|". $cache _id); |
Then you want to clear all the caches under this groupxxx group, like this:
The code is as follows |
Copy Code |
$smarty-> Clear_cache (null, "groupxxx"); |