26

According to this API doc, which is the only source I've found which describes the in-memory cache:

Chrome employs two caches — an on-disk cache and a very fast in-memory cache. The lifetime of an in-memory cache is attached to the lifetime of a render process, which roughly corresponds to a tab. Requests that are answered from the in-memory cache are invisible to the web request API. If a request handler changes its behavior (for example, the behavior according to which requests are blocked), a simple page refresh might not respect this changed behavior. To make sure the behavior change goes through, call handlerBehaviorChanged() to flush the in-memory cache. But don't do it often; flushing the cache is a very expensive operation. You don't need to call handlerBehaviorChanged() after registering or unregistering an event listener.

I need a better understanding of the in-memory cache. Specifically, I need Chrome to generate the full webRequest / resource waterfall every time I visit a site, including refreshing a page. Obviously, this can't be true if it's using an in-memory cache.

Is the memory cache a clean-slate for a new tab when I create a new tab?

What does "very expensive operation" mean quantitatively?

If I call handlerBehaviorChanged() every time a page is reloaded in the same tab, will that guarantee a full waterfall? In that case, a limit of 20 times over 10 minutes seems fairly low.

Any help is highly appreciated, thanks!

Dan Chang
  • 261
  • 1
  • 3
  • 5

1 Answers1

1

In your case I think that your problem is with the long term cache instead the in-memory cache. In the resource waterfall several requests can be marked as cached. There are various manners to avoid that if you want:

  • Instead of normal reloading (F5) press CTRL+F5. That will reload all the resources, I usually press CTRL+F5 several times although one time must be suficient.
  • If you need that your page reload some specific resources from server each time any user visit you then you can use some of this techniques:

Remember to apply these rules only for the resources that you really need to. Otherwise your webserver will be overloaded with innecesary requests.

As stated in the document mentioned: in-memory cache does not apply to different page renderings even for the same url and in the same tab (in-memory cache is attached to the lifetime of a render process), so I think that does not apply for your case. Rendering cycle ends each time the page is displayed and a different one starts if rendered again. For example: when a image is loaded for the first time appears in the waterfall, but no for later requests on the same page.

user1039663
  • 1,230
  • 1
  • 9
  • 15