Kfg Documentation
    Preparing search index...

    Class Kfg<D, S>

    The public surface shared by Kfg and KfgPool.

    Both implement this interface with the exact same generics, so a pool can be dropped in wherever a single instance was used before without touching call sites — dot-path autocompletion and return types stay identical.

    Type Parameters

    Implements

    Index
    "~cache": Record<string, any> = {}
    "~driver": D
    "~loaded": boolean = false
    "~options": KfgOptions<D>
    "~schema": { compiled: TObject; defined: S }
    config: StaticSchema<S>

    Proxy to access configuration properties directly. Example: kfg.config.database.port

    • Type Parameters

      • P extends string

      Parameters

      • ...paths: P[]

      Returns boolean

    • Transactional read-modify-write. Reads the latest persisted state, runs fn to mutate it, validates, and persists — atomically across processes when the driver supports it (preventing lost updates from concurrent writers). Falls back to load→mutate→save when it does not. fn may mutate the draft in place or return a replacement.

      Parameters

      Returns inPromise<D["async"], void>

    • Drops the in-memory cache and marks the instance as not loaded, releasing the memory it held. Persisted state is untouched: a lazy instance reloads on the next access, and any other needs an explicit load().

      Returns void