Actually say it is technology, may not be said to be the real technology. This is just the way I want to deal with the page, of course, with other people's ideas may be consistent. But I still want to give it a nice name. So what is the page buffer I'm referring to here? is to save a dynamically generated page for the next use. So the next time you access it, it may not need to be dynamically generated. It's like providing a cache. On my site, perhaps your site is the same, using technology such as templates, so that users see the page is dynamically generated. But a page for you is this, for others may still be, that is, in a period of time will not change, if the last generated results directly to the next access to the user is not better? Reduces the generation time, the efficiency is some higher. I think with the development of the site, speed and efficiency issues still need to be considered. Here I give my realization, hope to be helpful to everybody. Just a thought, no concrete implementation.
Use conditions
Is it best to use all the pages? I think it's not necessary and impossible. Buffering is because the next access may be exactly the same as the previous access. So it's not appropriate for pages that are constantly changing. For example, the page to display the count information is not appropriate. Also is if your dynamic page output, not first output to the variable, but directly back to the user, such as the use of Echo,print, ReadFile and so on output, I personally think that is still not done. Because you can't get the output, save it to a file (anyway, I was thinking for a long time not figuring out what to cut off the output and redirect it to the file). Then the more appropriate dynamic page processing is: The output should be able to put into a string. So the terms of use are:
The page basically doesn't change
The results of dynamic page processing can be stored in a string
It would be nice to use a template class to process a dynamic page. The processing of a template class is ideal for saving a processed page by setting replaceable variables in the template, and then replacing the variables in the corresponding template with the actual values, as well as putting the results in a string for output. Of course, it is also possible to generate output results from the processing of strings without using template classes. As for how to do it, we will not discuss it.
Realize
As mentioned earlier, not a real implementation, but a realization of the idea.
Processing process:
Generate a buffer file name based on Access requirements
To see if the file name exists, if it does not exist, generate a dynamic page, save the page, output the results, and then finish the 3rd step
The time that the statistics file was modified, and how long the files related to the dynamic page generation were modified
Compare buffer file modification time and other page modification time, if other page modification time is larger than the buffer file modification time, think dynamic result may change, then regenerate dynamic page result, save to file, and output result, end; otherwise perform step 5th
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service