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.