Welcome Guest, Not a member yet? Register   Sign In
Db caching just creating empty folders
#1

[eluser]tomasb[/eluser]
Hi folks,
I'm trying to implement the db caching class. I have set the cache directory, and the permissions on it are correct. There is a simple db query in my Index function. This runs fine and creates the "default+index" folder as expected. However, no matter what variations I have tried, no cache files are actually getting written to the "default+index" folder. Permissions are also correct on this folder (777).
Any ideas?
Much appreciated
T
#2

[eluser]TheFuzzy0ne[/eluser]
Only read queries are cached, not update/insert/delete queries. Posting some code might help us ascertain the problem more effectively.
#3

[eluser]tomasb[/eluser]
Yep, it's a simple read query:
Code:
$data['query'] = $this->db->get('data');
$this->load->view('welcome', $data);
Any other suggestions?
#4

[eluser]TheFuzzy0ne[/eluser]
When are you starting/stopping the caching?
#5

[eluser]tomasb[/eluser]
I set the boolean in database.php to true:

$db['default']['cache_on'] = TRUE;

This is just while I am testing. If I can get past this stage I will use the $this->db->cache_on(); method to cache individual queries.
Cheers,
T
#6

[eluser]TheFuzzy0ne[/eluser]
As far as I am aware, that only enables caching. You still need to use $this->db->start_cache() and $this->db->stop_cache() accordingly.
#7

[eluser]tomasb[/eluser]
Hey again,
I tried adding the db->start_cache() and stop around the query.. still no joy. The cache folder I am trying to write to is outside the application folder. I doubt this has anything to do with it as it is creating the default+index folder correctly.. just not writing anything to it.
Thanks for all your advice so far mate,
T
#8

[eluser]TheFuzzy0ne[/eluser]
Please post your code as it is now.
#9

[eluser]tomasb[/eluser]
So in my database.php I define:

Code:
$db['default']['cache_on'] = TRUE;
$db['default']['cachedir'] = "/opt/www/cache/";

and in my index function:
Code:
function index(){
    $data['query'] = $this->db->get('data');
    $this->load->view('welcome', $data);
}

This works fine on localhost, but not on my test server. Permissions on the created folder are fine and regular $this->output->cache method works fine.

If I use the:
Code:
$this->db->start_cache();

I get the same results: folder is created but no cache entry inside.
Cheers again,
T
#10

[eluser]Unknown[/eluser]
I am not so knowledgeable about this matter. So i have to learn it. Thanks for the post.


taux pret auto - taux pret auto differe selon la rise en compte ... calculent automatiquement le taux pour un prĂȘt automobile donne.




Theme © iAndrew 2016 - Forum software by © MyBB