duancai7568 2013-10-28 09:46
浏览 77
已采纳

CI页面缓存是否同时包含数据和页面?

I'm setting up the foundation for an application with a rapidly expanding database. Currently with only around 12000 users there's already a table with over 5 million record fields. This is starting to up the times queries in get executed a lot. Therefore I started thinking about caching either queries or the entire pages for a limited time (say 30 minutes, maybe an hour).

I've read up a lot about the caching options of CodeIgniter (v2.1.4) throughout the user-guide (here, here and here for example) and throughout a bunch of forums and SO questions about caching.

I also read up a little bit about Memcached and APC methods of caching. Based on comments and differences I'd like to use APC Caching.

So, does caching a page also include all of the data required to make up the page content? Or do the queries get executed each time a cached page is to be served up?

If the latter, how can I cache the query results for a limited time (say the before mentioned 30 or 60 minutes) to prevent the database becoming too busy?

The preferred situation would be to be able to store complete pages and have them refreshed (also without a user request for the page) every time a timer runs down. The page would of course include new data from a query as well.

  • 写回答

1条回答 默认 最新

  • dpglo66848 2013-10-28 10:08
    关注

    The CI-intern general caching ( http://ellislab.com/codeigniter/user-guide/general/caching.html ) using $this->output->cache(n); does cache the whole output (and only works if you use $this->load->view). The problem is, that the user-related content is cached too and delivered to other users. I got my experience with this...

    You can take a look at the detailled caching-lib http://ellislab.com/codeigniter/user-guide/libraries/caching.html. If your question was related to this library anyway, I cannot help you unfortunately.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 drone 推送镜像时候 purge: true 推送完毕后没有删除对应的镜像,手动拷贝到服务器执行结果正确在样才能让指令自动执行成功删除对应镜像,如何解决?
  • ¥15 求daily translation(DT)偏差订正方法的代码
  • ¥15 js调用html页面需要隐藏某个按钮
  • ¥15 ads仿真结果在圆图上是怎么读数的
  • ¥20 Cotex M3的调试和程序执行方式是什么样的?
  • ¥20 java项目连接sqlserver时报ssl相关错误
  • ¥15 一道python难题3
  • ¥15 牛顿斯科特系数表表示
  • ¥15 arduino 步进电机
  • ¥20 程序进入HardFault_Handler