# `MishkaCmsCore.Runtime.Handlers.SiteRuntime`
[🔗](https://github.com/mishka-group/mishka_cms_core/blob/v0.0.1/lib/mishka_cms_core/runtime/handlers/site_runtime.ex#L5)

Shared per-site purge of runtime artifacts — compiled modules, cached CSS/JS,
routing entries, and on-disk templates. Used by both the permanent-delete
teardown (`MishkaCmsCore.Runtime.Workers.SiteTeardownWorker`) and the
activate/deactivate/rename worker (`MishkaCmsCore.Runtime.Workers.SiteRuntimeWorker`).

Recompilation (the other direction) is `BootHandler.compile_site/2`.

# `module_specs`

Streams the site's module-backed records and returns `[%{"type", "key"}]` — the
inputs to `Helpers.module_name/3`. Call while the rows still exist (for the
permanent-delete teardown, capture before the cascade).

# `purge_parts`

Frees a site's runtime artifacts from RAM, all keyed by `site_name`: unloads the
given module specs, drops the cached CSS/JS (`AssetsState`), and clears routing
(`WebRunTimeMetaDataState`). When `remove_templates?` is true (rename /
permanent-delete) the site's on-disk template dir is removed too. Returns the
counts; `:modules` is how many were actually loaded (and thus genuinely freed).

# `unload_modules`

Unloads the given module specs of the site `site_name`, and nothing else — its cached CSS/JS,
routing and templates stay. Returns how many were loaded. A module is compiled for its site's
name and host, so a new host needs new ones: `BootHandler.compile_site/2` builds them again, and
a lazy one is built by the first request for it.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
