About medium and large development in the development of B/s caching (cache), some of my views, there are incorrect or there is a clerical error, please correct me. First, you should understand basic, knowledge about caching:
Q: What is the difference between a static cache and a dynamic cache? What is the cache?
A: caching, in one respect, simply means that you do not have to interact with the database again.
Static caching: That is, the html,shtml file.
Dynamic caching: That is to say, the cache is stored in the server's memory, as needed.
What is the difference between them?
Static caching does not consume load (server memory), but it takes up space on the server (because many files are generated), and most importantly because it generates a static cache that is not conducive to maintenance, because when you design a system, you have to take into account the consequences of this, as in design patterns, Some models are flexible, while others are not changed when they are first set up.
So, once again, design needs to be careful. Consider as many things as possible, such as: After the system is upgraded, is it still applicable (as far as possible), is it advantageous to replace the template, for some pages to add special or specific code, with shtml or HTML? Wait a minute.
And the dynamic cache, I think we all should know the move net "fan City Prodigal" write with Application as cache class, this is the most classic ASP in the case of dynamic cache. So I don't have to say too much application cache. His advantage is that the more static cache is conducive to maintenance and upgrades. The following is a schematic diagram of static caching and dynamic caching:
A: When do I use static caching and dynamic caching?
Q: This depends on the specifics of how you are the server, and how you design your program with the code
As an example:
My server load is large enough, do not need to consider the memory here, then you can use more dynamic cache, such as the News index page, home page, more index pages. Without having to generate static. such as moving the previous version (the current version I am very clear, now seems to be using a static cache) widely used dynamic caching technology. So in the background update, you need to manually update the cache, of course, here can be used URL rewrite, more conducive to search engine included. A reminder, this is also very important, but also remind a lot of personal set up a server friend, Search engine is not very friendly
(usually search engine's robot in the process of the site included.) will have been crawling your site, therefore, to do a traffic access system is still very necessary, remember Cnblog (blog Park) Dodo found in the detection of Yahoo robot every minute of the number of times is Google, which is the speed of your site is a certain aspect is influential, Sometimes it's still big.
But the static cache, above also said, is not conducive to maintenance. But the widely used MVC development approach, which separates the page from the program, can be improved much faster, as I have shown in the following figure:
Q: Is there any other way to do it?
A: there is. as shown below. The use of proxy technology to design, through the code to obtain static cache is available, if available, if not available (here is said to be unavailable, that is, the cache does not exist, or has changed the cache), then regenerate output, otherwise, direct output.
Using dynamic cache and static cache complete schematic diagram, with message communication. Simple description of how to apply the cache of the layout and application. Of course, you can not use the cache proxy to judge, remove Cacheproxy is the same.