Home > Backend Development > PHP Tutorial > Will php not return the cache line? Multiple Implementations_PHP Tutorial

Will php not return the cache line? Multiple Implementations_PHP Tutorial

WBOY
Release: 2016-07-13 10:24:19
Original
826 people have browsed it

Will php not return the cache line? Multiple implementations

1. Universal caching technology:

Data cache: The data cache mentioned here refers to the database query PHP cache mechanism. Every time you access the page, it will first detect whether the corresponding cache data exists. If it does not exist, connect to the database, get the data, and The query results are serialized and saved to the file. In the future, the same query results are obtained directly from the cache table or file.

The most widely used example is the search function of Discuz, which caches the result ID into a table and searches the cache table first when searching for the same keyword next time.

As a common method, when multiple tables are associated, the contents in the attached table are generated into an array and saved in a field of the main table. When necessary, the array is decomposed. The advantage of this is that only one table can be read, but the disadvantage is that There will be many more steps to synchronize the two data. The database is always the bottleneck. Trading the hard disk for speed is the key point of this.

2. Page cache:

Every time you visit a page, it will first check whether the corresponding cached page file exists. If it does not exist, connect to the database, get the data, display the page and generate the cached page file at the same time, so that the page file will be the same the next time you visit. It worked. (Template engines and some common PHP caching mechanism classes on the Internet usually have this function)

3. Time triggered cache:

  Check whether the file exists and the timestamp is less than the set expiration time. If the file modification timestamp is greater than the current timestamp minus the expiration timestamp, then use the cache, otherwise update the cache.

4. Content trigger cache:

  When inserting data or updating data, force the PHP cache mechanism to be updated.

5. Static cache:

The static cache mentioned here refers to static caching, which directly generates text files such as HTML or XML, and regenerates them when there are updates. It is suitable for pages that do not change much, so I won’t talk about it here.


6. Memory cache:

Memcached is a high-performance, distributed memory object PHP caching mechanism system, used to reduce database load and improve access speed in dynamic applications.

7. PHP buffer:

There are eaccelerator, apc, phpa, xcache. I won’t talk about these. Search a bunch of them and see for yourself. If you know that there is such a thing, it’s OK

8、 MYSQL cache:

This is also considered non-code level. Classic databases use this method. Look at the running time below, it is like 0.09xxx

9. Web cache based on reverse proxy:

  Such as Nginx, SQUID, mod_proxy (apache2 and above are divided into mod_proxy and mod_cache)

10. DNS polling:
BIND is an open source DNS server software. This is a big deal to mention. Just search it yourself. Everyone knows that this thing exists.
I know that some big websites such as chinacache do this. To put it simply, it is multi-server. The same page or file is cached on different servers and automatically parsed to the relevant server according to the north and south.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/827214.htmlTechArticleWill php not return the cache line? Multiple implementations 1. Universal caching technology: Data caching: The data caching mentioned here refers to the database query PHP caching mechanism. Every time a page is accessed...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template