Take the 2-minute tour ×
Stack Apps is a question and answer site for apps, scripts, and development with the Stack Exchange API. It's 100% free, no registration required.

Sure a delay of about a minute is not much, but when you consider that if you post a question the API sees it immediately, and often something using the API is ahead of the stackoverflow site, then it looks more like a problem?

Is this by design or just feasible or something.

share|improve this question
    
Correct the spelling "stackoverflwo". –  chanchal1987 Sep 23 '10 at 7:51

1 Answer 1

up vote 1 down vote accepted

You're seeing the interplay of caching between the sites and the API.

The short of it is, both SO and the API implement fairly aggressive cache policies. I won't go into SO here, for one its always changing, because it varies depending on the pages, and age of the content.

The API, more simply, caches every response for 1 minute. So, if two consumers are hitting the same route (with the same parameters) within 1 minute they'll get the same result, assuming the cache was empty when the first request was received*.

Consequently, its possible for a "result" to appear in the API immediately (if the cache is empty), or after a delay (if the cache is not). Whether or not a "result" appears to be in sync with the site depends on how the user visits the site (logged in or anonymous), and the page viewed (as noted before, the policy varies).

So, yeah, ultimately this is by design.

*Note that things get complicated when you start accounting for network latency, all of this discussion is from the server's perspective.

share|improve this answer
    
Thought it would be something like this, just found it a bit strange that the API was ahead of the sites and then behind the sites. –  Jonathan. Sep 19 '10 at 8:00

You must log in to answer this question.

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