class

Azu::ComponentRegistry

Inherits Reference < Object

Thread-safe component registry with pooling support

Constructors

new(max_pool_size : Int32 = 50)
Source

Instance methods

cleanup_all

Thread-safe component cleanup on close

Source
cleanup_disconnected(gc_interval : Time::Span) : Nil

Thread-safe iteration with cleanup

Source
delete(id : String) : Component | Nil

Thread-safe component removal

Source
get(id : String) : Component | Nil

Thread-safe component retrieval

Source
get_from_pool(type : String, & : -> Component) : Component

Get component from pool or create new one

Source
get_typed(id : String, type : T.class) : T | Nil forall T

Type-safe component retrieval with compile-time type checking Returns nil if component doesn't exist or is not of the expected type

Example:

if counter = registry.get_typed("counter_1", CounterComponent)
  counter.increment # No cast needed, type is CounterComponent
end
Source
register(id : String, component : Component) : Nil

Thread-safe component registration

Source
size

Get current component count (for monitoring)

Source