How does php browser cache solve high concurrency problems?

Source: Internet
Author: User
Php browser cache solves high concurrency I write a cache in the page header like this, & lt ;? Php & nbsp; $ cache_time & nbsp; = & nbsp; 60*10; & nbsp; // 10 minute cache $ modified_time & nbsp; = & nbsp; @ $ _ SERVER ['htt php browser cache solves high concurrency
I wrote a cache in the header of the page,
 $ Cache_time = 60*10; // cache in 10 minutes
$ Modified_time = @ $ _ SERVER ['http _ IF_MODIFIED_SINCE '];
If (strtotime ($ modified_time) + $ cache_time> time ()){
Header ("HTTP/1.1 304 ");
Exit;
}
Header ("Last-Modified:". gmdate ("D, d m y h: I: s", time (). "GMT ");
Echo" ";
Echo date ('Y-m-d H: I: S', time ());
?>

Question 1:
The browser will only retrieve data from the browser within 10 minutes;
Question 2:
If the database data is updated, the dynamic page is not a dynamic page, and the browser is still reading the page. How can we perform page updates and cache re-start computing? Is there any way to change the cache and start again?
Online request and answer!
How do we solve high concurrency problems?
------ Solution --------------------
Php can only buffer some data to solve high concurrency needs to start from the server, such as your Apache, Ngix cache can refer to smarty
------ Solution --------------------
The cache is called. when the data is not updated, call the cache. when calling the cache, you should determine whether the data is updated. if there is an update, you can request the data again.
------ Solution --------------------
Your memory refresh will be updated.
------ Solution --------------------
Every time you access the page, the browser will initiate a request like the server. the 304,200 you see is what the server tells the browser, not what the browser determines. For dynamic pages, even if you set the cache time, if the data changes, the latest data will be returned by default, instead of the data cached by the browser.
------ Solution --------------------
If you do not have to do this for caching, you can use memcache to do better than you do... my personal thoughts

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.