diff --git a/doc/api/module.md b/doc/api/module.md index 3bb25c3f313da1..665a64c0505b66 100644 --- a/doc/api/module.md +++ b/doc/api/module.md @@ -199,6 +199,13 @@ Compilation cache generated by one version of Node.js can not be reused by a dif version of Node.js. Cache generated by different versions of Node.js will be stored separately if the same base directory is used to persist the cache, so they can co-exist. +At the moment, when the compile cache is enabled and a module is loaded afresh, the +code cache is generated from the compiled code immediately, but will only be written +to disk when the Node.js instance is about to exit. This is subject to change. The +[`module.flushCompileCache()`][] method can be used to ensure the accumulated code cache +is flushed to disk in case the application wants to spawn other Node.js instances +and let them share the cache long before the parent exits. + ### `module.getCompileCacheDir()` + +> Stability: 1.1 - Active Development + +Flush the [module compile cache][] accumulated from modules already loaded +in the current Node.js instance to disk. This returns after all the flushing +file system operations come to an end, no matter they succeed or not. If there +are any errors, this will fail silently, since compile cache misses should not +interfer with the actual operation of the application. + ### Class: `module.SourceMap`