2012年9月10日星期一

PHP缓存加速




Web应用程序使用PHP和SQL Server,如果火车感觉大部分考虑到查询语句。连接器和速度的关系,SOKEN杰克的软件处理的硬件限制

不通过大规模的交通,通常会发生,如果页面直接查询来提取数据。我们希望解释的图形,棒,简要介绍了关系不会有一个图形化的工具

Web客户端 - >网络服务器---> SQLServer的(下)
Web客户端<---- Web服务器返回<--- SQLServer的返回

使Web服务器的PHP解析器和代码后解释上述数据到SQLServer,排序的要求,和HTML格式的Web客户端的响应。
低效天的会有所不同,这取决于实施的目的,作为一个公告板和实时的的输出形成haejwoya除非猜测。

因此,高速缓存存储动态完成处理该文件,如下图所示。
解析PHP的数据到SQL合作不问任何游客数在5分钟内没有一个Web服务器,只读取缓存的文件和输出haejumyeon'll的。
服务器的负载和速度,当然是更快。

保存该文件,可以这么说,一个将在5分钟内更新。
1名访客1分钟rachimyeon万,5000的事件fucking'd一次


(?
   $reqfilename = "index";
   $cachefile = "cache/".$reqfilename.".xanadu";
   $cachetime = 5 * 60; //5 minutes
   // Serve from the cache if it is younger than $cachetime
   if (file_exists($cachefile) && (time() - $cachetime < filemtime($cachefile))) {
     include($cachefile);
     echo "<!-- Cached ".date('jS F Y H:i', filemtime($cachefile))." -->\n";
     exit;
   }

   // start the output buffer
   ob_start();
?)


Here is Page-Content home

(?
   $fp = fopen($cachefile, 'w'); // open the cache file for writing
   fwrite($fp, ob_get_contents()); // save the contents of output buffer to the file
   fclose($fp); // close the file

   // Send the output to the browser
   ob_end_flush();
?)


没有评论:

发表评论