database caching with codeigniter problems

Bill picture Bill · Feb 19, 2011 · Viewed 8.4k times · Source

I've just built a site using codeigniter and 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. in my database config file, I set 'cache_on' = TRUE and then for the '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!

Answer

jfoucher picture jfoucher · Feb 19, 2011

You need to use a relative path, not a url.

Try changing cachedir to application/cache, like so:

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