Comparison of various cache types in php cms what are the common cache types in php? Are related advantages and disadvantages? Ask for advice! ------ Solution -------------------- several common cache technologies in PHP ------ solution -------------------- view request chain customers -- & gt; client cache --- proxy (cache server) --- & gt; | comparison of various caches of php cms for static files
Which of the following cache types are commonly used in php?
Are related advantages and disadvantages?
Ask for advice!
------ Solution --------------------
Several common cache technologies of PHP
------ Solution --------------------
View request chain
Client cache proxy (cache server) ---> | static file
|-Dynamic php --> opcode cache (apc) --> File Cache ---> memcache cache (or memory cache) --> database cache
------ Solution --------------------
Data cache:
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.
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)
Time-triggered cache:
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.
Content trigger cache:
When data is inserted or updated, the PHP Cache is forcibly updated.
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. I am not too lazy to change the content of the CP framework. the content is similar and easy to implement. it can be used together in several ways, however, the following content is a server-side cache solution. non-code-level solutions can only be achieved through multi-party cooperation.
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.
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.
MYSQL cache:
This is not code-level. the classic database uses this method. See the following running time, such as 0.09xxx.
My post part is modified according to the guy in blue. ini. the MYISAM table of 2 GB can be around 5s. it is said that he has changed it for almost a year.
------ Solution --------------------
Great questions...
In fact, cache can be added to almost every running link of php (similar to other languages) applications,
No cache is used. it depends on the development cost and the cache cost .....
Caching is the only thing in software development that can improve efficiency in addition to algorithms.