Thursday, November 21, 2024

Node.js provides built-in API for on-disk caching

Node.js 22.8.0, the newest launch of the event-driven JavaScript runtime, provides a JavaScript API to allow on-disk caching of all modules loaded after the API known as, presenting a caching choice for code.

The API known as module.allow.CompileCache(). It overrides the NODE_COMPILE_CACHE surroundings variable, which solely finish customers might use to allow on-disk caching. The brand new API lets software and library authors handle the caching of their very own code. The answer is a built-in different to v8-compile-cache packages, providing higher efficiency and assist for ESM (ECMAScript Modules).

Launched on September 3, Node 22.8.0 will be downloaded from Nodejs.org. It’s labeled as a present launch fairly than an LTS (long-term assist) launch. With this replace, Node now helps requiring code protection to satisfy a particular threshold earlier than a course of efficiently exits. Builders who wish to use this functionality should set the –experimental-test-coverage flag. Thresholds will be set for sorts of protection together with department, perform, and line coverages. Additionally in model 22.8.0, a taste of vm.createContext() has been added to create a context with out contextifying its world object when vm.constants.DONT_CONTEXTIFY is used. That is appropriate when customers wish to freeze the context or pace up world entry if they don’t want the interceptor habits.

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles