Skip to main content

Module script_cache

Module script_cache 

Source
Expand description

SQLite-backed bytecode cache for scripts.

Stores compiled bytecode indexed by (canonical_path, mtime). On 2+ runs, skips lex/parse/compile entirely — just deserialize and eval into fusevm.

Cache location: ~/.cache/stryke/scripts.db

Invalidation: mtime mismatch → recompile, update cache.

Modules§

constants_pool_codec
Serde codec for serializing Vec in bytecode Chunk.

Structs§

CachedScript
Cached script bundle: AST + compiled bytecode.
ScriptCache
SQLite-backed script cache.

Statics§

CACHE
Global cache instance (lazy-initialized, Mutex-protected for thread safety).

Functions§

cache_enabled
Check if SQLite cache is enabled (default: true, disable with STRYKE_SQLITE_CACHE=0).
clear
Clear global cache.
default_cache_path
Default path for the script cache db.
evict_stale
Evict stale entries from global cache.
file_mtime
Get mtime from file metadata as (secs, nsecs).
stats
Get global cache stats.
try_load
Try to load a cached script by path. Returns None on miss.
try_save
Store a compiled script in the cache.