Memcache - How to prevent frequent cache rebuilds? <p>I have been working for Memcache for the last week or so, I have managed to work out how to set keys/delete keys. This is fine but Im still attempting to work out how to do the same for a while loop of results. </p> <p>For example I will have a while loop of posts, from within the logic the function will check to see if Memcache is set, if not it will collect the results and create the key. My question is this, <strong>If I have set the looped data into a set key and display the set key (Newest First) Then what happens when a new post is inserted?</strong> I understand I can set a time limit on the set key, but as the content will/could be added whenever it seems that setting a limit could still display old posts. So my question is how would I be able to update the set key. </p> <p>The only way I can think of a possible solution is for when a user inserts a new post, this deletes the key, and when the all posts is viewed again this is when the key gets set again. But this seems rather counter productive, just as if there are 10's of users submitting posts then all the posts will be set over and over again (Doesn't really seem beneficial)</p> <p>I hope this makes sense, any help or guidance would be appreciated.</p>