2

I am using setInterval to call Rest API's from my web page in about every 60 seconds. Now it is making request and hogging Network with too much request due to which after sometime my page becomes slow and non-responsive.

Can anyone help me out about how to clear Network Tab cache in Dev tools without refreshing page. P.S. I don't want to clear all of Cache just the Network cache after 5 min.

5
  • May be duplicate of stackoverflow.com/questions/8155064/… Commented Feb 25, 2019 at 9:06
  • I don't want to clear the app cache, just Network cache only. Commented Feb 25, 2019 at 9:09
  • 1
    I think it is same , you may not able to clear the cache Commented Feb 25, 2019 at 9:10
  • Is there anything else can I do which don't hog page ? Commented Feb 25, 2019 at 9:15
  • 1
    how about exploring websocket? the change may be big but i think that is better. Else you can change the interval in setInterval to some higher value. Another thing you can do is use of promise. Call the rest api only when current one is done. You can check ` Promise resolve` Commented Feb 25, 2019 at 9:19

1 Answer 1

1

You cam use caches.delete(cacheName).

caches.keys().then(function(names) {
    for (let name of names)
        caches.delete(name);
});

But it is not supported in IE. For more details and browser supports, check here

Sign up to request clarification or add additional context in comments.

2 Comments

Do Network Cache has some sort of cacheName? Because I dont think it has.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.