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 metadata提取的PDF元数据,如何转换为一个Excel
  • ¥15 关于arduino编程toCharArray()函数的使用
  • ¥100 vc++混合CEF采用CLR方式编译报错
  • ¥15 coze 的插件输入飞书多维表格 app_token 后一直显示错误,如何解决?
  • ¥15 vite+vue3+plyr播放本地public文件夹下视频无法加载
  • ¥15 c#逐行读取txt文本,但是每一行里面数据之间空格数量不同
  • ¥50 如何openEuler 22.03上安装配置drbd
  • ¥20 ING91680C BLE5.3 芯片怎么实现串口收发数据
  • ¥15 无线连接树莓派,无法执行update,如何解决?(相关搜索:软件下载)
  • ¥15 Windows11, backspace, enter, space键失灵