Welcome Guest, Not a member yet? Register   Sign In
Caching or generating?
#2

[eluser]Jelmer[/eluser]
I must admit I have been pondering a similar question myself. The reason I cache the queries, or a set of queries, is that it's easier to have cache without expiration and always up-to-date when you can delete your cache relating to the query.

Using my MP_Cache library I can cache a query when its being read and delete it when its edited or deleted. Similarly I can write the cache for a listing of queries when I have the rules for those queries non-flexible so I can delete the (partial) listings when one of its entries is being edited or deleted. This creates caches that are non-expiring and always up-to-date...

... but this kind of caching only takes down the database-load and the problem of some (possibly) heavy post-processing is still there.

You can of course solve this by using CI's full page caching and depend on expiration to solve the problem of your cache not being current.

Another solution I'm looking into is doing it by something I called "dependencies" in my second version of MP_Cache. What I did is I started out with the first solution which caches the queries and than cached the full page afterwards as well. But the full-page cache has the rules that it's depending on the query-caches, which makes it refresh itself when one of those caches is newer than the full-page-cache itself. I'm just not sure whether this kind of checking might not become quite heavy on its own.

If you're interested, the (largely untested) code for my second version of MP_Cache can be found at http://mpsimple.mijnpraktijk.com/mp_cache.htm.


Messages In This Thread
Caching or generating? - by El Forum - 04-20-2009, 03:57 AM
Caching or generating? - by El Forum - 04-20-2009, 10:16 AM
Caching or generating? - by El Forum - 04-20-2009, 11:54 AM
Caching or generating? - by El Forum - 04-20-2009, 12:27 PM



Theme © iAndrew 2016 - Forum software by © MyBB