Phil Sturgeon's Cache Library |
[eluser]Peanut[/eluser]
Code: // cached model call Ok.. so one negative is that he has horrible documentation. Anyway, what exactly is the array (3rd parameter) suppose to be? I know 1st parameter is model name. 2nd parameter is method name. 3rd parameter, I have no idea. 4th paramter, seconds until cache is deleted. So can anyone help me on what the 3rd parameter is? EDIT And another question. Is there a way to make a cache live until a certain update on the database table?
[eluser]Aken[/eluser]
Looking at the source code answers your question pretty quickly. Not familiar enough to answer the second part, though.
[eluser]Peanut[/eluser]
I did look at the source code.. I don't know if I'm just overlooking it, but I dont' know what to put in the array... or what I'm suppose to put at all. I know everything else. And I figured out to have it live for unlimited amounts of time and manually delete and recache it, you can either put 0 in the 4th parameter or leave it blank.
[eluser]CroNiX[/eluser]
Never looked at it or used it so it's a total guess...but probably parameters passed to the method.
[eluser]Eduard Stankovic[/eluser]
3rd param is array of parameters ... Code: $this->cache->model('blog_m', 'getPosts', array($category_id, 'live', $foo, ....... ), 120); Code: $this->blog_m->getPosts($category_id, 'live', $foo, .......) ; Do u understand now ?
[eluser]Peanut[/eluser]
Yes it all makes perfect sense now =) I didn't know you actually replaced the model call with this. Anyway, I have a news system and I want to cache the posts, but it also counts the comments each news post has, but everytime a person posts, I want to show the latest posts. However... is there anyway you can make a certain part not cache and the others cache. I would like to cache the actual news post until a new post is inserted by admin, but would like to show the latest comments so I should probably not cache those (COUNT(comment_id)). And why is it giving me this error: Code: A PHP Error was encountered
[eluser]Eduard Stankovic[/eluser]
when you add new post call this: Code: $this->cache->delete_all(); it deletes all cached files
[eluser]Peanut[/eluser]
Yeah, but then there is really no point in caching the news post if you have to delete it every single time a user comments, is there?.. That seems wasteful..
[eluser]Eduard Stankovic[/eluser]
Code: $data = $this->cache->get('cached-name'); try to play around it .... maybe one of them will be what are u looking for ... |
Welcome Guest, Not a member yet? Register Sign In |