[Web] Possible bug for Cache the network request

The racing condition would be one possible bug when we apply cache a newtwork request.

For example, we implement a search box, for all the requests, we apply caches.

When we have a cache ready, for example, we search for word:

start

then issue a new request:

start w

before data coming back, we restore to previous search:

start

It may happens that the search result for "start w" will override the cache result.

To solve this problem, we need to apply "Aborting logic".

原文地址:https://www.cnblogs.com/Answer1215/p/14109154.html