Jump to content

Content caching question


karpatzio

Recommended Posts

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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

"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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.