Caching of Recordsets with Reactor Caching Driver |
[eluser]wapatv[/eluser]
Hi! I'm developing our new site using CI Reactor. Previously we used no framework, but did used ADOdb Database Abstraction Library for dealing with the db and the queries. ADOdb has a feature where I can cache recordsets for a period of time (http://bit.ly/hSQX0f). I was reading about Reactor's new Caching Driver, but I don't know if it fits my need similar to what I used to to with the ADOdb's Recordsets caching. Here is a sample controller function I did using Caching Driver. Code: function news_list($catid, $limit, $offset) { When I load the URL: ie: http://localhost/news/news_list/14/50/0 The cache file is saved and request after that are loaded from the cached file. So thats good... My issue is that if I request another params: ie: http://localhost/news/news_list/18/50/50 I get the same results from the previously cached, because it sees no difference between them. Since the saved cache name is always the same (news_lists), regardless that the requesting params are different and the data returned is other. In ADOdb, the name of the cached file was unique for each query requested. So if I requested the same page with different query params, it would save them separately. What options could I have to accomplish something similar to what I'm looking for? Thanks!
[eluser]wapatv[/eluser]
I did this change and I could say "it works"... buts, is there a cleaner/better way to do this? Code: function news_list($catid, $limit, $offset) { Notice that I changed the save file to have the same params I sent to the function. Meaning that for the URL: http://localhost/news/news_list/14/50/0 will save a cached file named "news_list_14500" and http://localhost/news/news_list/18/50/50 will save a file named "news_list_185050" Being both different cache files based on different params. Is that any optimal? |
Welcome Guest, Not a member yet? Register Sign In |