karpatzio Posted June 24, 2008 Share Posted June 24, 2008 Recently i visited a blog powered by movable type and it seemed that all of the pages were cached yet they do update when contents change, and not only those certain pages but all of the other pages as well. How exactly is this done in Movable Type and other blog applications in general? Quote Link to comment https://forums.phpfreaks.com/topic/111690-content-caching-question/ Share on other sites More sharing options...
Ninjakreborn Posted June 24, 2008 Share Posted June 24, 2008 Theoretically it wouldn't be very hard to just check and see if there is updated content. Generally when something cache's but updates as needed the person might keep a log of files and there "size". There cache system might use something to verify whether or not the current size/modification date matches that on the one that's cached by the system and replace them as needed. Quote Link to comment https://forums.phpfreaks.com/topic/111690-content-caching-question/#findComment-573578 Share on other sites More sharing options...
cngodles Posted June 25, 2008 Share Posted June 25, 2008 Is there a way to cache without actually refering to the database? In my opinion, you would cache to save database calls, but is that a correct assumption? Quote Link to comment https://forums.phpfreaks.com/topic/111690-content-caching-question/#findComment-573737 Share on other sites More sharing options...
Ninjakreborn Posted June 25, 2008 Share Posted June 25, 2008 "depends" on what you are caching. There are times when you could save data that is accessed a lot into a file...this can save some mysql load. However if you don't do it right it can cause more strain on the server. But if there was for example something you are doing in a webpage that is HEAVILY accessed...and it was causing database crashes. You could start caching certain parts of your data and limiting the amount of times the system had to hit the database. There are other methods for caching. There are "Systems" built for just that. It makes routine copies of the database and when people hit the site it gets the most used content from the "Cache" and only hits the database a couple of seconds to verify the version numerings are the same (kind of like a middle/man database) so the load is split between the cache system and Mysql. Some just have a secondary system on a secondary server to kick in as Cache when the database is overloaded. Quote Link to comment https://forums.phpfreaks.com/topic/111690-content-caching-question/#findComment-573743 Share on other sites More sharing options...
Aeglos Posted June 25, 2008 Share Posted June 25, 2008 A common way of caching without checking database for content diferences is to cache the pages only when there is no previous cache of that particular page and you are requesting it. Then, when you update something in the database, you delete all cached pages that will access that data. That way the cache stays current and there are no "check db for new content" calls. Quote Link to comment https://forums.phpfreaks.com/topic/111690-content-caching-question/#findComment-573866 Share on other sites More sharing options...
cngodles Posted June 25, 2008 Share Posted June 25, 2008 That method is exactly what I needed. As per one of my previous projects, we had a script that would gather data from lots of sources, then display a number, usually an average. There were about 6,000 users for the site, and what small percentage of that were logged in were adding data. So, I would delete the cached number whenever someone would insert data, then update the cached number when someone requested it when there was no cache present. Would it make more sense to do this with a flat file of some sort? I've heard of memcache, but I'm not sure where to start with that. Quote Link to comment https://forums.phpfreaks.com/topic/111690-content-caching-question/#findComment-574082 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.