dongluo3331 2016-07-27 14:18
浏览 47
已采纳

Codeigniter查询缓存不使用文件锁

I was reviewing the CodeIgniter code details and I've found (what I think is) a weird inconsistency between the caching techniques used for DB Queries vs. Views.

For caching Views (via the Output class) Codeigniter uses file locking. This is to ensure multiple simultaneous users do not accidentally write to the same cache file at the same time.

Now this makes absolute sense to me. The problem is, the DB query caching technique (via the DBCache class) does not seem to use this technique, and it's got me thinking.

Is this deliberate? Why would there be no need for file locking for database queries (given that they would also be prone to the same problem above)? Or this is a simple bug in the code?

  • 写回答

1条回答 默认 最新

  • drasebt1835 2016-07-27 14:39
    关注

    Found the answer to this myself.

    It turns out that Database queries also use file locking.

    The DBCache class in Codeigniter uses the File helper - which in turn uses file locking in it's write_file() function.

    The Output caching does this more explicitly without the File helper.

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

报告相同问题?

悬赏问题

  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器