List icon Contents

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\JxBrowser\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 Engine.

HTTP cache size

The default size is calculated at the start time. It depends on the available disk space in the volume where the cache is located.

You can configure the HTTP cache size using an appropriate option when constructing the Engine. For example, to set a 32MB limit, please use the following code:

Java
Kotlin
Engine engine = Engine.newInstance(EngineOptions.newBuilder(renderingMode)
        .diskCacheSize(33554432)
        .build());
val engine = Engine(renderingMode) {
    diskCacheSize = 33554432
}

If the disk cache size is zero, a default value will be calculated and used automatically.

Clearing HTTP cache

To clear the HTTP cache associated with a specific Profile and wait until all the cache entries are marked for deletion:

Java
Kotlin
profile.httpCache().clear().join();
profile.httpCache().clear().join()

Using the Engine.httpCache() method you will get the HttpCache service for the default profile.