Raxol.Performance.ETSCacheManager (Raxol v2.8.0)

View Source

High-performance ETS cache manager for Raxol hot paths.

Provides dedicated caches for performance-critical operations:

  • ANSI parser cache
  • Cell creation cache
  • Theme/style resolution cache
  • Buffer operations cache
  • Layout calculation cache

Uses ETS tables with optimized access patterns and LRU eviction.

Summary

Functions

Cache a cell creation.

Cache a parsed CSI sequence.

Cache font metrics calculation.

Cache a layout calculation. Supports both full tree layouts and partial node layouts.

Batch cache multiple layouts. Useful for pre-computing common viewport sizes.

Returns a specification to start this module under a supervisor.

Clear all caches.

Clear a specific cache: :csi_parser, :cell, :style, :buffer, :layout or :font_metrics. Any other name returns {:error, :unknown_cache}.

Get a cached cell.

Get a cached CSI parse result.

Get cached font metrics.

Get a cached layout. Supports constraint matching for responsive layouts.

Get a cached style resolution.

Starts the server, registered under its module name unless :name is given: clear_all/0, clear_cache/1, stats/0 and the opt-in caching in Raxol.UI.ThemeResolver and Raxol.UI.StyleProcessor reach it by that name.

Get cache statistics.

Functions

cache_buffer_region(buffer_id, x, y, width, height, data)

Cache a buffer region.

cache_cell(char, style_hash, cell)

Cache a cell creation.

cache_csi(sequence, result)

Cache a parsed CSI sequence.

cache_font_metrics(key, result)

Cache font metrics calculation.

cache_layout(tree_hash, constraints, result)

Cache a layout calculation. Supports both full tree layouts and partial node layouts.

cache_layouts_batch(layouts)

Batch cache multiple layouts. Useful for pre-computing common viewport sizes.

cache_style(theme_id, component_type, attrs_hash, resolved_style)

Cache a style resolution.

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

clear_all()

Clear all caches.

clear_cache(cache_name)

@spec clear_cache(atom()) :: :ok | {:error, :unknown_cache}

Clear a specific cache: :csi_parser, :cell, :style, :buffer, :layout or :font_metrics. Any other name returns {:error, :unknown_cache}.

get_buffer_region(buffer_id, x, y, width, height)

Get a cached buffer region.

get_cell(char, style_hash)

Get a cached cell.

get_csi(sequence)

Get a cached CSI parse result.

get_font_metrics(key)

Get cached font metrics.

get_layout(tree_hash, constraints)

Get a cached layout. Supports constraint matching for responsive layouts.

get_style(theme_id, component_type, attrs_hash)

Get a cached style resolution.

handle_manager_cast(msg, state)

Callback implementation for Raxol.Core.Behaviours.BaseManager.handle_manager_cast/2.

handle_manager_info(msg, state)

Callback implementation for Raxol.Core.Behaviours.BaseManager.handle_manager_info/2.

start_link(init_opts \\ [])

Starts the server, registered under its module name unless :name is given: clear_all/0, clear_cache/1, stats/0 and the opt-in caching in Raxol.UI.ThemeResolver and Raxol.UI.StyleProcessor reach it by that name.

stats()

Get cache statistics.