Cache
This guide describes the cache types supported by Chromium and shows how to work with them.
Chromium supports the following cache types:
- HTTP cache
- Blink cache
- HTML5 AppCache
When any resource request is made from a page, it first goes through the Blink loader and the Blink cache. A request to the browser process may or may not be issued from there. As it goes through the browser’s network stack, it reaches the HTTP (disk or memory) cache. There is no explicit communication from a page to the cache.
HTML5 AppCache is used explicitly by a web page. It stores data independently of the other caches.
HTTP cache
By default, the HTTP cache stores the resources fetched from the web on a disk or in the memory. Chromium itself decides how to cache the resources for optimal performance.
The memory cache stores and loads the resources to and from the process memory—RAM. It is a fast but non-persistent way.
The content is available only until you close the Browser
.
The disk cache is persistent. The cached resources are stored and loaded to and from the disk.
On Windows the disk cache is stored in the Cache
folder in the user data directory
and may look like this:
Users\<user_name>\AppData\Local\Molybden\browsercore-<version>\UserData\Cache
On macOS and Linux, the disk cache is stored in the user’s temp directory.
On macOS, it may look like:
/var/folders/jc/8cmxmwhn5w99b_2lhz78k46w0000gq/T/UserData/Cache
On Linux:
/tmp/UserData/Cache
Incognito mode
In the Incognito mode Chromium stores the resources only in
the memory and does not use the disk. The cached resources are only available until you delete the Profile
or close
the app.
Clearing HTTP cache
To clear the HTTP cache associated with a specific Profile
and wait
until all the cache entries are marked for deletion:
profile->httpCache()->clear([]() {
std::cout << "Cache is empty" << std::endl;
});