Cache or Query??
MattR Offline
Junior Member
**
Posts: 40
Joined: Jul 2010
Post: #1
Cache or Query??
I've just updated my Social Sites plugin so it caches the list of sites you've set up, to save a query when they're used on the forum. All the forms to configure the Social Sites still query (I prefer to use a query in areas like that to 'make sure' it's got all the current data and not an outdated cached version), but on pages that display them and will get hit heavily on big forums (profiles and showthread), it reads the cache.

My question is this: when the plugin is newly installed, the cache of sites is 2KB... not a lot, but if people add lots of sites it'll obviously get bigger. Things like this get cached to save queries, as it'll be quicker to use a cached array than query and build an array on every page load, but when does the increase in the memory footprint outweigh the benefit from saving a query?? I mean, when viewing a thread, and the icons for social sites are displayed in the postbit, it'd only query the database once, at the start of showthread.php; would it ever get to a point where it'd be better to just have a query, rather than store a big array in the cache, which, by the nature of how the cache works, would be loaded on every page load instead of just where it's needed??

Basically; query on showthread.php which could get a lot of hits, or a possibly large cache being loaded on all pages?? Which is better?? I'd have thought a cache won't always be more efficient than a query, because it's loaded on all pages.
(This post was last modified: 01-22-2011 09:22 AM by MattR.)
01-22-2011 09:18 AM
Find all posts by this user Quote this message in a reply

« Next Oldest | Next Newest »

Messages In This Thread
Cache or Query?? - MattR - 01-22-2011 09:18 AM
RE: Cache or Query?? - ZiNgA BuRgA - 01-22-2011, 11:38 AM
RE: Cache or Query?? - Firefox Wins - 01-31-2011, 02:04 AM
RE: Cache or Query?? - ZiNgA BuRgA - 01-31-2011, 08:17 AM
RE: Cache or Query?? - frostschutz - 02-04-2011, 02:38 AM

 Standard Tools
Forum Jump: