Looking for a DB Caching system in CodeIgniter which Caches Queries by DB Table [closed]
开发者_JS百科
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 8 years ago.
Improve this questionI am looking for a DB Caching System with which I can Cache my Queries by DB Table Name. I am now using CI 1.7.2 and mySQL for DB.
I know CI has a built-in DB Caching system, but the problem is it caches the Queries by Controller/Method Names. I have a Online Software and expecting a huge hit per day. So I can't rely on Controller/Method naming because when a query will be updated it is not possible for me to delete that Query Related Caches by Controller/Method naming. And also I can't delete all the caches because if so, there will be no need to use the caching system.
If it is almost impossible then please suggest me any other best way to serve my purpose.
Another option—and one that I think should generally be tried before messing with caching in CI—is query caching in MySQL.
Add the following to the [mysqld] section of /etc/my.cnf (or your specific location) and then restart mysqld:
query_cache_type=1
query_cache_size = 20M
That will enable query caching by default, with a cache size of 20 Megs, which you can tune to suit your needs. Enable the CI output profiler in your controllers to see the resulting query times (on the second execution of each query):
$this->output->enable_profiler(TRUE);
If you need to further reduce the controller execution time, then I would recommend looking at a solution like MP_Cache or APC that were both already recommended.
You can use MP_Cache that will solve your problem, I strongly believe. Here is a User Guide of MP_Cache. It is compatible with CodeIgniter and you can cache your Model even your Library and you can set the Cache Name by your-self.
精彩评论