codeigniter : what is the best practice for caching? [closed]
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
开发者_如何学编程Closed 5 years ago.
Improve this questioni'm working on a big project. i'm using codeigniter, but i'm facing a hard question, where should i using codeigniter caching. should i use it inside models? or in the controller? also as my project is big, i'm facing a hard time trying to guess what caches should i delete as the codeigniter caching is depending on the controller name, so when i update a table i have to check all controllers that are using that table and delete their cache. that kills me.
what is the best practice for this?
Thanks
CodeIgniter have a good cache for small projects, but when you need to exclude things, it gets kind of messy. It's not decentralized.
A good solution for query cache is http://code.google.com/p/improved-query-caching/ and as Wesley told you, http://philsturgeon.co.uk/code/codeigniter-cache.
I also don't recommend using the query cache for ALL your queries, but instead using the ones that really needs it. It depends a LOT in the project and its size.
Remember that cache use only view. For example if you want to change language on the site it doesnt work because codeigniter will load old wiev with old language. And then you must wait untill new cache will be created and loaded with language which is currently set.
精彩评论