Advice Smarty Design tips for emptying cache judgment
Only today began to learn smarty ...
There's an empty cache. The judgment is not clear, please pointing out:
Home page or directory cache is very good understanding, query data more, no cache, every time to check the database
But to the specific content of the article, is not there is no need for it?
Scenario 1: If the article has been modified, then certainly to empty the cache, how to know that the article has been modified? Check the time of database modification ... Modify time and article content are bound together in a table of ah ... What is the difference between this and direct query?
Scenario 2: When the article is clicked, there is a record of the number of clicks, which is placed in the data sheet of the article ... In order to get the number of clicks, or to query the data table of this article (the number of clicks and the text is also placed in a table AH) ... What difference does it have? In addition, the number of clicks to make a table connected to the article table ... This database is too much to design, right?
Share to:
------Solution--------------------
Scenario 1: Can be judged using the is_cached () method
Scenario 2: Get clicks to check the article list it's not surprising ...
------Solution--------------------
For Scenario 1:
This is your figment needs, if you cache the article, then it is equivalent to maintain a file-type database
If there is a need, it is also generating a static page instead of caching the data
Regenerate static pages when an article modification occurs