Facturx.XSD.Cache (Facturx v0.7.0)

Copy Markdown View Source

Long-lived owner of the compiled XSD schemas.

Started by the :facturx application supervisor; there is nothing to call. It is documented because Facturx.XSD describes the two speeds its presence explains.

:xmerl_xsd stores a compiled schema in an ETS table tied to the process that compiled it. This GenServer compiles each bundled schema once (so it owns those tables and keeps them alive) and publishes the compiled state via :persistent_term. Any process can then read that state and validate in parallel (~0.6 ms/call) against the shared, read-only (:protected) table, instead of recompiling (~5 ms) on every call.

A schema that fails to compile is not cached and is not fatal: validation falls back to per-call compilation, and the reason is logged at :warning so the slow path is never a silent mystery.

Summary

Functions

Returns a specification to start this module under a supervisor.

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.