Database cache and page Cache Usage

Source: Internet
Author: User
CI provides database cache and page cache. If a page is purely static, use the page cache directly. If a page contains a database query, do you want to cache the database or directly use the page cache? If it seems that the page cache is used, can the database query cache be used? CI provides database cache and page cache. If a page is purely static, use the page cache directly. If a page contains a database query, do you want to cache the database or directly use the page cache? If it seems that the page cache is used, can the database query cache be used?

Reply content:

CI provides database cache and page cache. If a page is purely static, use the page cache directly. If a page contains a database query, do you want to cache the database or directly use the page cache? If it seems that the page cache is used, can the database query cache be used?

We recommend that you use page caching for content stations, portal homepage, and article pages.

If a page is purely static, use the page cache directly.

The cache is not needed if it is purely static.

If a page contains a database query, do you want to cache the database or directly use the page cache? If it seems that the page cache is used, can the database query cache be used?

If there is a database, you can check the page usage scenario to determine which cache to use. If it is an article, the page is cached. If it is a system that contains a lot of program logic, it will cache the database. It is generally used in combination.

Yes, this is what the page cache is.
However, some problems may occur in actual use. For example, for a large page, most of the data is static, and a bean curd block is real-time. This is embarrassing.
Therefore, the cache template + data cache method is generally used. That is, cache the template of the entire page, and then fill the template with the data cache, a real-time bean curd block to be filled in real time.
Another method is that, even if real-time data is processed using ajax and other caches, this method is not recommended because blocks are blank and ugly before being loaded.

You can take a look at the smarty information. This is basically the idea. Sometimes there is a trade-off between performance and maintainability. If the changes are small, they are purely static. If the changes are large, templates are used.

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.