Phil Sturgeon's Cache Library - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=22) +--- Thread: Phil Sturgeon's Cache Library (/showthread.php?tid=57236) |
Phil Sturgeon's Cache Library - El Forum - 02-27-2013 [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? Phil Sturgeon's Cache Library - El Forum - 02-27-2013 [eluser]Aken[/eluser] Looking at the source code answers your question pretty quickly. Not familiar enough to answer the second part, though. Phil Sturgeon's Cache Library - El Forum - 02-27-2013 [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. Phil Sturgeon's Cache Library - El Forum - 02-27-2013 [eluser]CroNiX[/eluser] Never looked at it or used it so it's a total guess...but probably parameters passed to the method. Phil Sturgeon's Cache Library - El Forum - 02-28-2013 [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 ? Phil Sturgeon's Cache Library - El Forum - 02-28-2013 [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 Phil Sturgeon's Cache Library - El Forum - 02-28-2013 [eluser]Eduard Stankovic[/eluser] when you add new post call this: Code: $this->cache->delete_all(); it deletes all cached files Phil Sturgeon's Cache Library - El Forum - 02-28-2013 [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.. Phil Sturgeon's Cache Library - El Forum - 02-28-2013 [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 ... |