Advice Smarty design skills for emptying cache judgment

Source: Internet
Author: User
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

  • 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.