简体   繁体   English

具有codeigniter问题的数据库缓存

[英]database caching with codeigniter problems

I've just built a site using codeigniter and mysql. 我刚刚使用codeigniter和mysql构建了一个站点。 It works great, but I want to turn the database caching on. 它工作得很好,但我想打开数据库缓存。 I figured I would just do it globally rather than caching each select statement manually. 我想我会全局地做,而不是手动缓存每个select语句。 in my database config file, I set 'cache_on' = TRUE and then for the 'cachedir' = "http://www.mydomain.com/application/cache/dbcache" 在我的数据库配置文件中,我设置'cache_on'= TRUE,然后设置'cachedir' = "http://www.mydomain.com/application/cache/dbcache"

I set the whole cache directory as writable, so I think everything is set up correctly. 我将整个缓存目录设置为可写,因此我认为所有内容都已正确设置。 After loading a few pages, I looked back into the cache directory, and it's still empty. 加载几页后,我回头看了一下缓存目录,它仍然是空的。 I'm assuming that means that nothing was cached. 我假设这意味着没有任何缓存。 Am I missing something? 我错过了什么吗? I'm not getting any errors and all my select statements are showing the results. 我没有收到任何错误,我的所有选择语句都显示结果。 What am I doing wrong / and how can I tell if the caching is working? 我做错了什么/如何判断缓存是否有效?

Thanks! 谢谢!

You need to use a relative path, not a url. 您需要使用相对路径,而不是URL。

Try changing cachedir to application/cache , like so: 尝试将cachedir更改为application/cache ,如下所示:

$db['default']['cachedir'] = 'application/cache';

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM