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

posted @ 2020-12-09 15:59  Zhentiw  阅读(59)  评论(0编辑  收藏  举报