Welcome Guest, Not a member yet? Register   Sign In
help understanding db_cache
#1

[eluser]jstrebel[/eluser]
I have been wrapping my head around cacheing in CI. I just have a minor question.

I added:
$this->db->cache_on();

to a get method in a model, and this method is used in a 3 controllers..

So when i look in the /cache dir I see new folders like:

db+index default.index tour+index

so when there is an insert of a new record, i need to dump the old cache objects..

so in my insert method.. do i have to add

$this->db->cache_delete('db','index');
$this->db->cache_delete('tour','index');
$this->db->cache_delete('default','index');

to remove all the cached objects for this 1 get method?

I do not want to use $this->db->cache_delete_all(); as there may be other objects that do not need to be deleted.

If I am correct above, it seems silly to have to track/note every cache folder that is created for one $this->db->cache_on(); to then make sure they all get deleted on insert.

Please correct me if I am off base.

Seems like storing and removing cached items by model/method seems ideal, as you can the just isolate and delete cached object on a per method basis.




Theme © iAndrew 2016 - Forum software by © MyBB