Emerge.Config.AssetCache (Emerge v0.5.1)

Copy Markdown View Source

Limits for retained image pixels and parsed SVGs. Set this record as Emerge.Config.Assets.cache. Budgets apply separately to each renderer.

%Emerge.Config{
  assets: %Emerge.Config.Assets{
    cache: %Emerge.Config.AssetCache{max_entries: 32, max_bytes: 32 * 1024 * 1024}
  }
}

Fields

  • max_entries — maximum retained decoded-image entries, including rasterized SVG sizes; defaults to 256.
  • max_bytes — retained decoded-pixel budget in bytes; defaults to 268_435_456 (256 MiB). This is not compressed file size.
  • svg_tree_max_entries — maximum retained parsed SVGs; defaults to 64. One parsed SVG can be reused to draw multiple sizes.
  • svg_tree_max_bytes — estimated parsed-SVG storage budget in bytes; defaults to 16_777_216 (16 MiB), separate from rendered pixels.

All values are non-negative integers. A zero entry/byte limit disables retention in the corresponding cache; images still load and draw. Limits do not bound peak decoding memory, fonts or total application memory. These fields require a new viewport to change. See Use assets for cache tuning.

Summary

Types

Canonical form after nested keyword records have been expanded.

Typed keyword shorthand accepted in this record's parent field.

t()

Types

normalized_t()

@type normalized_t() :: t()

Canonical form after nested keyword records have been expanded.

options()

@type options() :: [
  max_entries: non_neg_integer(),
  max_bytes: non_neg_integer(),
  svg_tree_max_entries: non_neg_integer(),
  svg_tree_max_bytes: non_neg_integer()
]

Typed keyword shorthand accepted in this record's parent field.

t()

@type t() :: %Emerge.Config.AssetCache{
  max_bytes: non_neg_integer(),
  max_entries: non_neg_integer(),
  svg_tree_max_bytes: non_neg_integer(),
  svg_tree_max_entries: non_neg_integer()
}