Universal Cache Technology
Data cache: In this case, the data cache refers to the database query PHP cache mechanism, each time you visit the page, will first detect the corresponding cache data exists, if not exist, connect to the database, get the data, and the query results are serialized and saved to the file, Later, 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 the next time the same keyword is searched.
For a common method, multi-table association, the schedule of the contents of the array is saved to a field in the main table, the need for the array decomposition, the advantage is only read a table, the disadvantage is that two data synchronization will be more than a few steps, the database is always the bottleneck, with the hard disk speed, is the key point.
Page cache:
Each time you visit the page, will detect the corresponding cache page file exists, if not exist, connect to the database, get data, display the page and generate the cache page file at the same time, so the next visit to the page file will play a role. (the template engine and some common PHP caching mechanism classes on the web usually have this feature)
Time-Triggered cache:
Check that the file exists and that the timestamp is less than the expiration time of the setting, and if the timestamp of the file modification is greater than the current timestamp minus the expiration timestamp, then cache is used, otherwise the cache is updated.
Content-Triggered caching:
Forces the PHP cache mechanism to be updated when data is inserted or updated.
Static cache:
Static caching refers to static, directly generated HTML or XML and other text files, there is an update when re-generated once, suitable for the less changing pages, this does not say.
The above content is a code-level solution, I direct CP other framework, too lazy to change, the content is almost, very easy to do, and will be used together in several ways, but the following content is the server-side caching scheme, non-code level, to have multi-party cooperation to do
Memory Cache:
Memcached is a high-performance, distributed memory object PHP caching mechanism system for reducing database load and increasing access speed in dynamic applications.
Buffer for PHP:
There are eaccelerator, APC, Phpa,xcache, this is not to say, search a bunch of a bunch of, see for yourself, know that this thing is OK
MySQL cache:
This is also non-code level, the classic database is used in this way, look at the following running time, 0.09xxx and the like
I stick paragraph according to the Blue Guy modify the latter part of the My.ini bar, 2G MyISAM table can be around 0.05S, it is said that he changed back and forth for a year
Reverse proxy-based Web caching:
such as Nginx,squid,mod_proxy (Apache2 and above are divided into mod_proxy and Mod_cache)
Examples of Nginx
DNS Polling:
Bind is an open source DNS server software, this to say it is big, their own search, you know there is this thing on the line.
I know that there are chinacache and other major stations to do so, said the simple point is a multi-server, the same page or file cache to different servers, according to the North-South automatic resolution to the relevant server.
http://www.bkjia.com/PHPjc/478732.html www.bkjia.com true http://www.bkjia.com/PHPjc/478732.html techarticle Universal Caching Technology Data cache: The data cache referred to here refers to the database query PHP caching mechanism, each time you visit the page, will first detect the corresponding cache data exists, such as ...