Smarty Cache Collection Simple explanation

Source: Internet
Author: User

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");

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.