PHP Cache Technology details

Source: Internet
Author: User
Tags php template

The WEB program obtains information mainly by querying the database. When the database is not very large, there will be no major problems. however, with the development of the website, when the database grows in a geometric level, there will be bottlenecks. so the PHP cache technology was born. PHP cache includes PHP compilation cache and PHP data cache.

PHP is an interpreted language that can be compiled and run simultaneously. The advantage of this running mode is that the program is easy to modify, but the running efficiency is low. PHP compilation cache makes improvements to this situation, so that the PHP language can cache the compilation results of the program once it is run. In this way, no re-compilation is required for each subsequent operation, which greatly improves the PHP running speed.
PHP data cache is used in PHP development to cache data processing. The two main directions are cache database data and cache PHP template data.

PHP compilation cache: currently, the most common PHP compilation cache tools include APC, Accelerator, and xcache.

PHP is an interpreted language. The following two steps are required when executing code in PHP:

1. compilation process. PHP reads the file, compiles the file, and generates an intermediate code that can be executed on the Zend Engine virtual machine.

2. Execution Process. PHP executes the intermediate code directly.

In the following two cases, the efficiency of PHP Running code is low:

1. Even if the PHP code file has not changed, it will be re-compiled by PHP.

2. If there are referenced files, PHP also takes time to recompile these referenced files. Therefore, PHP compilation and cache tools are required to cache the compilation results of PHP programs. In this way, you only need to compile the PHP program once, And do not re-compile the program meaningless.

PHP Data Cache: PHP Data Cache includes database data cache and PHP template data cache. Tools for caching database data include memcache. Tools for caching PHP template data include smarty.

Articles you may be interested in
  • PHP cache operation instance details
  • Smarty Cache Technology Summary
  • Thinkphp Method for disabling caching
  • PHP force browser not to cache
  • PHP cache page Functions
  • Php programmer tutorial website advertisement service
  • Summary of methods for saving arrays as text formats in php
  • Use the PHP function memory_get_usage to obtain the current PHP memory consumption for program performance optimization.

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.