V8 Cache
V8 Caching
V8 allows extra caching of code compilation to help improve load time of the page. This API allows you to interface with V8’s cache by building and loading caches with provided options, or automatically. This API is a work-in-progress and experimental, as it does not consider factors like being up to/out of date, etc. See this V8 post for some more information on code caching.
build(options?)
Build a V8 Cache of the current Gluon Window to a JSON file.
Arguments
Options
By default the build will be as eager as possible. There are extra optional options you can use for building, provided as an object:
eager
- Use eager compilation (default: true)includePreload
- Try to include preload scripts in the V8 Cache (default: true)reload
- Reload the page to force script recompilation in order to cache (default: true)path
- Path to save the V8 Cache to, recommended to leave as default (default:v8Cache.json
in Gluon’s browser data)urls
- URLs of scripts to compile (default: automatically generated from current page)
Examples
Window.v8Cache.build();
load(path?)
Load a V8 Cache from a JSON file (optional). Gluon will automatically try to load a V8 Cache in the default path if it exists.
Arguments
Path
Path of V8 Cache to load, defaults to v8Cache.json
in Gluon’s browser data.
Examples
Window.v8Cache.load();
exists(path)
Check a V8 Cache JSON file exists.
Arguments
Path
Path of V8 Cache JSON file to check.
Examples
Window.v8Cache.exists('/path/to/v8Cache.json');