Welcome Guest, Not a member yet? Register   Sign In
DB Caching
#1

[eluser]simonspoken[/eluser]
I've been playing around with caching for the last few hours. Because of the size of our database, it's taking 1.4 seconds for CodeIgniter to execute the index() page.

I turned caching on, and that was a MASSIVE improvement. 0.007 seconds.

Awesome, right? Well, no. Because of the nature of our site, we must store session identifiers in the URL (and therefore in links). However, when regular caching is turned on, the session id's in all links belong to the first user to access the site.

So, I turned to DB caching. I know the cache dir is writable, since I've been using it for the above.

I set up caching in config/database.php and turned it on. 0.6 seconds. I then added:

$this->db->cache_on();
// my active record stuff goes here
$this->db->cache_off();

This still didn't make a difference. I've done a bit of debugging in database/DB_cache.php and know that the cache dir is set correctly in config/database.php

Does anyone know how to make this work? Cheers
#2

[eluser]low battery[/eluser]
I wanna use the DB Caching too, but i am not sure how to use it.
as you say
$this->db->cache_on();
// the active record stuff goes here. such as: $this->db->select('id,title,content');
$this->db->cache_off();

that is all? thanks a lot!
#3

[eluser]TheFuzzy0ne[/eluser]
Please can you a) confirm that the cache files are actually being written, and b) give us a genuine example of the code you're using?

I trust you realise that you can only cache read queries (such as select queries), and not write queries (such as delete, insert and update)?

One final question, how can you be sure it's the database that's slow, and not your server, or something in the script?




Theme © iAndrew 2016 - Forum software by © MyBB