What are the differences between php static caching and pure static caching?

  question

Recently, I wrote a small program using thinkphp

I manually wrote and generated static html module, with batch manual generation in the background.

Later, it was discovered that the tp framework has a static caching function, that is, php reads real html files through paths after caching.

What are the advantages and disadvantages of these two ways?

The two have a common purpose, one of which is to reduce the server’s high concurrent processing and database load.
In China, website statization also has another purpose to “invest in search engines” so as to achieve better SEO optimization. (In fact, I personally think that search engines have no special distinction and preference for static or dynamic pages. The effect of controlling page keywords is the same).

Both of the storage media described in your article are disks. The former is “static”. Actually, there is nothing wrong with php. Only on the server side, these files are all produced under php control. Users are all static pages directly accessed.

The latter “text cache” is more controllable. The expiration time of cache, local cache of pages, etc. can be defined to better control content update, etc. The last thing the user visits is the php dynamic page. php will explain what to do, whether to read the file directly or whether the cache has expired and needs to be regenerated.

If it is a larger site, the large amount of data on the page is also a headache for disk consumption and maintenance.

In addition
I have never used Thinkphp, but according to some PHPFrame I know. Basically, many drivers for cache adapters will be provided.

Can be replaced by a better solution, such as:
Use memcached (memory object cache). This is actually similar to the text caching process, except that the storage medium is replaced by memory. The reading speed is certainly faster.

Another example is Alternative php Cache, Xcache, eAccelerator, etc. Such cache schemes can be called PHP accelerators. It is different from the file storage and memcached memory object storage mentioned above. The details can be seen here.Which php accelerator is the most reliable APC, XCache, eAcceleratorSome of the outer chains in the article can be clicked. One of them introduced their similar execution process.

I recommend using a caching scheme. The static treatment of the website feels pretty “ugly”.

In fact, the cache I mentioned later is a little different from what you said: “tp framework has static cache function.” You said here that the application may be an output cache provided by tp, i.e. the page view is stored as a whole file. It helps you to do more detailed file generation control, such as generating files with html suffix. You can take a closer look at the tp manual, especially at the cache.