BundleDescriptorCache

class BundleDescriptorCache(val rootDir: Path = defaultCacheDir())(source)

On-disk cache of lazily-extracted ksl.simulation.ModelDescriptor JSON for bundles that were not pre-enriched by kslpkg enrich. Entries are keyed by the SHA-256 of the bundle's source JAR so replacing the JAR automatically invalidates the cache.

Cache layout under rootDir:

//meta.json (cacheSchemaVersion, writtenAt) //.json

The cache is best-effort: any I/O error during read or write is logged and swallowed. A failing cache never breaks the loader — the descriptor is recomputed on the next load.

Constructors

Link copied to clipboard
constructor(rootDir: Path = defaultCacheDir())

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

the directory under which per-JAR cache entries live; defaults to ~/.ksl/bundle-cache

Functions

Link copied to clipboard
fun read(jarSha256: String, modelId: String): ModelDescriptor?

Returns the cached descriptor for the given (JAR-hash, modelId) pair, or null on any kind of miss: no cache entry, schema-version mismatch, malformed JSON, or I/O error.

Link copied to clipboard
fun write(jarSha256: String, modelId: String, descriptor: ModelDescriptor)

Writes the descriptor into the cache. Failures are logged and swallowed; an unwritable cache directory never prevents the caller from proceeding.