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