相关疑难解决方法(0)

PHP ob_start vs opcode APC,解释差异和现实世界的用法?

前提:我不是要重新发明轮子,我只是想了解一下.

输出缓存可以轻松实现:

//GetFromMyCache returns the page if it finds the file otherwise returns FALSE
if( ($page = GetFromMyCache($page_id)) !== FALSE )
{
   echo $page; //sending out page from cache
   exit();
}

//since we reach this point in code, it means page was not in cache
ob_start(); //let's start caching

//we process the page getting data from DB

//saving processed page in cache and flushing it out
echo CachePageAndFlush(ob_get_contents());
Run Code Online (Sandbox Code Playgroud)

另一篇文章中解释得很好,并在另一篇文章解释.

但接下来是APC (默认情况下将包含在PHP6中).

  1. APC是否曾经安装在服务器上的模块,现有的 PHP代码运行速度更快, …

php caching apc ob-start

7
推荐指数
1
解决办法
1407
查看次数

标签 统计

apc ×1

caching ×1

ob-start ×1

php ×1