Table of Contents

Interface IPortrayalAssetCache

Namespace
EncDotNet.S100.Portrayals
Assembly
EncDotNet.S100.Portrayals.dll

Process-scoped, spec-segmented storage for decoded portrayal assets (compiled XSLT transforms, parsed SVG symbols, line styles, area fills, colour palettes, compiled Lua scripts, and raw Lua source strings).

public interface IPortrayalAssetCache

Remarks

Introduced by PR-3 of the asset-caching audit (docs/internal/asset-caching-audit.md ยง6 PR-3) to lift the per-catalogue-instance caches up to the spec level. A single IPortrayalAssetCache instance is owned by PortrayalCatalogueManager per SpecRef and shared by every S101PortrayalCatalogue / S131PortrayalCatalogue / GmlPortrayalCatalogueBase wrapper that the manager hands out for that spec. This means two open datasets of the same product pay the underlying OpenAsync(string, CancellationToken) cost for each asset only once, not once per dataset.

The catalogues continue to own the loading logic; they only delegate storage to the injected cache.

Properties

AreaFills

Cache of parsed area fills keyed by area-fill id. Populated on first call to GetAreaFill.

IDictionary<string, AreaFill> AreaFills { get; }

Property Value

IDictionary<string, AreaFill>

CompiledXslt

Cache of compiled XSLT transforms keyed by rule name. Populated on first call to GetCompiledRule.

IDictionary<string, XslCompiledTransform> CompiledXslt { get; }

Property Value

IDictionary<string, XslCompiledTransform>

LineStyles

Cache of parsed line styles keyed by line-style id. Populated on first call to GetLineStyle.

IDictionary<string, LineStyle> LineStyles { get; }

Property Value

IDictionary<string, LineStyle>

LuaScripts

Cache of compiled Lua Script instances keyed by script name. Populated on first call to GetLuaScript.

IDictionary<string, Script> LuaScripts { get; }

Property Value

IDictionary<string, Script>

LuaSources

Cache of raw Lua source strings keyed (case-insensitively) by bare file name. A cached null records a negative lookup so missing-module require() calls do not re-open the asset source on every miss (see PR-2 of the asset-caching audit).

IDictionary<string, string?> LuaSources { get; }

Property Value

IDictionary<string, string>

PaletteLoadGate

Serializes the one-shot palette load across catalogues that share this cache. Multiple datasets of the same spec (for example, every cell of one S-101 exchange set) load on separate threads but share a single per-spec cache; without this gate they would race to populate the non-thread-safe palette dictionary or observe it half-populated. See issue #321.

SemaphoreSlim PaletteLoadGate { get; }

Property Value

SemaphoreSlim

Palettes

Cache of loaded colour palettes keyed by palette type (Day/Dusk/Night). Populated together by the catalogue's palette scan; the scan happens once per cache (see PalettesLoaded).

IDictionary<PaletteType, ColorPalette> Palettes { get; }

Property Value

IDictionary<PaletteType, ColorPalette>

PalettesLoaded

Sticky flag set by the catalogue once it has performed the one-shot scan of Catalogue.ColorProfiles that populates Palettes. When two catalogues share a cache this flag prevents the second catalogue from re-running the scan (and re-opening the underlying colour-profile assets).

bool PalettesLoaded { get; set; }

Property Value

bool

Symbols

Cache of parsed SVG symbols keyed by symbol id. Populated on first call to GetSymbol.

IDictionary<string, SvgSymbol> Symbols { get; }

Property Value

IDictionary<string, SvgSymbol>