QUICKJS.SCRIPT
QUICKJS.SCRIPT LOAD script
QUICKJS.SCRIPT EXISTS sha1 [sha1 ...]
QUICKJS.SCRIPT FLUSH [ASYNC | SYNC]
Manage the QuickJS (JavaScript) script cache used by QUICKJS.EVAL and QUICKJS.EVALSHA. Behavior mirrors SCRIPT, on a cache that is independent of the PUC-Lua (SCRIPT), Luau (LUAU.SCRIPT), Wren (WREN.SCRIPT), Tcl (TCL.SCRIPT), and Python (UPYTHON.SCRIPT) caches.
QUICKJS.SCRIPT LOAD script— compile the script (this catches a syntax error without executing it) and cache it, returning its 40-character SHA1 digest.QUICKJS.SCRIPT EXISTS sha1 …— array of1/0, one per digest.QUICKJS.SCRIPT FLUSH— clear the JavaScript cache, reply+OK.
Example
> QUICKJS.SCRIPT LOAD "return ARGV.reduce((a, b) => a + parseInt(b), 0)"
"a1b2c3..."
> QUICKJS.SCRIPT EXISTS a1b2c3...
1) (integer) 1
> QUICKJS.SCRIPT LOAD "return 1 +"
(error) ERR Error compiling script: unexpected token in expression: '}'
> QUICKJS.SCRIPT FLUSH
OK
See also
QUICKJS.EVAL,QUICKJS.EVALSHA.SCRIPT— the PUC-Lua equivalent.