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 求MCSCANX 帮助
  • ¥15 机器学习训练相关模型
  • ¥15 Todesk 远程写代码 anaconda jupyter python3
  • ¥15 我的R语言提示去除连锁不平衡时clump_data报错,图片以下所示,卡了好几天了,苦恼不知道如何解决,有人帮我看看怎么解决吗?
  • ¥15 在获取boss直聘的聊天的时候只能获取到前40条聊天数据
  • ¥20 关于URL获取的参数,无法执行二选一查询
  • ¥15 液位控制,当液位超过高限时常开触点59闭合,直到液位低于低限时,断开
  • ¥15 marlin编译错误,如何解决?
  • ¥15 VUE项目怎么运行,系统打不开
  • ¥50 pointpillars等目标检测算法怎么融合注意力机制