Summary of various methods of PHP Cache technology
Source: Internet
Author: User
Summary of various PHP Cache technologies the data cache mentioned here refers to the PHP Cache mechanism for database queries. each time a page is accessed, it will first check whether the corresponding cache data exists. if it does not exist,... summary of various methods of PHP Cache technology
The data cache mentioned here refers to the PHP Cache mechanism for database query. when accessing the page every time, the system checks whether the cache data exists. if the cache data does not exist, it connects to the database to obtain the data, serialize the query results and save them to the file. later, the same query results will be obtained directly from the cache table or file.
1. general cache technology:
Data cache: the data cache here refers to the PHP Cache mechanism for database queries. each time you access the page, it first checks whether the cache data exists. if it does not exist, it connects to the database, obtain the data and serialize the query results and save them to the file. the same query results will be obtained directly from the cache table or file. The most widely used example is the Discuz search function. The result ID is cached in a table and the table is searched in the cache next time when the same keywords are searched. For example, when multiple tables are joined, an array generated in the appendix is saved to a field in the master table, the advantage is read-only tables. The disadvantage is that two data synchronization steps are many more steps, and the database is always the bottleneck. Changing the disk speed is the key point.
2. page cache:
Each time you access the page, the system first checks whether the corresponding cached page file exists. if it does not exist, it connects to the database to obtain data, displays the page, and generates cache page files at the same time, in this way, the page file will play a role in the next visit. (The template engine and some common PHP Cache mechanism classes on the Internet usually have this function)
3. cache triggered by time:
Check whether the file exists and the timestamp is earlier than the set expiration time. if the modified timestamp of the file is greater than the current timestamp minus the expiration timestamp, use the cache; otherwise, update the cache.
4. content-triggered cache:
When data is inserted or updated, the PHP Cache is forcibly updated.
5. static cache:
The static cache mentioned here refers to static, which directly generates HTML, XML, and other text files. it is re-generated once when there is an update. this is suitable for pages that do not change much.
The above content is a code-level solution. the following content is a server-side cache solution. non-code-level solutions can only be achieved through cooperation among multiple parties.
6. memory cache:
Memcached is a high-performance, distributed memory object PHP Cache mechanism system that reduces database loads in Dynamic Applications and improves access speed.
7. php buffer:
There are eaccelerator, apc, phpa, and xcache. you don't need to talk about this. you can search for a bunch of them and read them by yourself. if you know what it is, OK.
8. MYSQL cache:
This is not code-level. the classic database uses this method. See the following running time, such as 0.09xxx.
9. reverse proxy-based Web cache:
For example, Nginx, SQUID, mod_proxy (apache2 and above are also divided into mod_proxy and mod_cache)
10. DNS round robin:
BIND is an open-source DNS server software, which is too big to be mentioned. you can search for it by yourself.
I know that some big sites do this. Simply put, they are multiple servers. They cache the same page or file on different servers and automatically resolve the file to the relevant servers in north-south mode.
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.