CodeIgniter Forums
problem trying to cache certian queries? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: problem trying to cache certian queries? (/showthread.php?tid=9189)



problem trying to cache certian queries? - El Forum - 06-16-2008

[eluser]diez[/eluser]
ok in the database caching class it says to:
* Create a writable directory on your server where the cache files can be stored.
* Set the path to your cache folder in your application/config/database.php file.
* Enable the caching feature, either globally by setting the preference in your application/config/database.php file, or manually as described below.

so i use CI's cache folder (systems/cache) which is the default. and i enable the cache setting to the true in the db config.

however when i use these lines of code to select which queries i want to cache.
$this->db->cache_on();
$obj_query = $this->db->query($str_sql);
$this->db->cache_off();

it doesn't work....it just caches every query in my controller function being called?
i just want this one query to cached...not all of them.

if i disable the cache setting in the db config...then gets cached at all.


any help?


problem trying to cache certian queries? - El Forum - 06-16-2008

[eluser]diez[/eluser]
sorry, i have got it to work now.

i created the folder on my linux server with the root user and not apache...so my caches could never be written to the directory.