0

I'm used to Stack Overflow so when I want to see if there is new content I press F5.
Too many times I've pressed it just as the message about 1 post with new activity appears. This is what happens :

Just as my finger touches refresh, I see the message come up.. but it's too late...

This is what happened once the pages is refreshed.

No new activity... If I wait a few seconds (10 or so) it comes back up and then I get my new activity. A little late.

What is actually happening ?

  • 4
    Caching. It is always caching. The page is cached for a minute... – Oded Jun 5 '13 at 15:26
  • 3
    The content served when you initially request is cached for about a minute, but the real-time updates are not. – Jeremy Banks Jun 5 '13 at 15:27
7

The AJAX/ws calls make changes to the page as they happen.

At the same time, we cache the page for about a minute.

This means that when you refresh you get the cached page without any of the changes that happened since last cached.

  • why does it cache for such a long time? – bwoebi Jun 5 '13 at 15:28
  • 6
    @bwoebi - A minute is not that long. – Oded Jun 5 '13 at 15:29
  • So what happens to the version I get when I press on the new activity banner? What if I press the banner to see the new activity and then refresh. Do I get the last cached page or the one with new activity ? Also shouldn't the page cache everytime there is new activity? I've never done much web so I don't quite no how it works. What I'm porposing her emight sound stupid. – ʞunɥdɐpɐɥd Jun 5 '13 at 15:29
  • It's long enough so that I'm annoyed very time I switch away and then I have to wait a minute for seeing the newest updates when I switch back... – bwoebi Jun 5 '13 at 15:30
  • 1
    @ʞunɥdɐpɐɥd - We don't invalidate the cache as soon as something updates. We cache the result of the first hit once the cache has expired. This is a performance optimization. – Oded Jun 5 '13 at 15:30
  • 1
    @bwoebi: You are aware how many users use SO? Caching something for 30 seconds or caching it for a minute can make a significant change in server-load. Not to mention that the frontpage does not need to be realtime. – Time Traveling Bobby Jun 5 '13 at 15:31
  • 4
    @ʞunɥdɐpɐɥd: that version only exists in your browser, it's created by AJAX. Invalidating the cache every time there's a new question would make caching pointless, there are like a bjillion questions posted every second. (estimate may be off slightly). – Wooble Jun 5 '13 at 15:31
  • @Oded Good it makes sense. Thanks ! – ʞunɥdɐpɐɥd Jun 5 '13 at 15:31
  • @Wooble actually that version is created on the fly with AJAX when the banner is clicked. The "x questions with new activity" is just a link, the actual new questions are not loaded anywhere until it's clicked. – Shadow The Dragon Wizard Jun 5 '13 at 15:33
  • @Wooble: I'm pretty sure that's how some of the queues feel like. – Time Traveling Bobby Jun 5 '13 at 15:35
  • 2
    @ShaWizDowArd: well, yeah, but the point is that the click causes an AJAX request that adds those questions to the page you've already got open, it doesn't create the full page on the server and serve it to you. – Wooble Jun 5 '13 at 15:41
1

In order to load the recently modified content you should click on the grey bar itself:

enter image description here

That notification is real time, and is not cached; clicking there will load all of those items.

If you refresh the page you will use the most recently cached version of that page, which might not have all of the recently active content.

  • @M.NightDemonbobby Okay. What's your point? The new activity is realtime; a new page load is off of the last cached version. That the activity is that new means that it's unlikely the cache will have been updated... – Servy Jun 5 '13 at 15:33
  • Missed the last part of your post, sorry. – Time Traveling Bobby Jun 5 '13 at 15:34

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .