class
Azu::ComponentRegistry
- Azu::ComponentRegistry
- Reference
- Object
Overview
Thread-safe component registry with pooling support
Defined in:
azu/spark.crConstructors
Instance Method Summary
-
#cleanup_all : Nil
Thread-safe component cleanup on close
-
#cleanup_disconnected(gc_interval : Time::Span) : Nil
Thread-safe iteration with cleanup
-
#delete(id : String) : Component | Nil
Thread-safe component removal
-
#get(id : String) : Component | Nil
Thread-safe component retrieval
-
#get_from_pool(type : String, & : -> Component) : Component
Get component from pool or create new one
-
#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
-
#register(id : String, component : Component) : Nil
Thread-safe component registration
-
#size : Int32
Get current component count (for monitoring)
Constructor Detail
Instance Method Detail
Get component from pool or create new one
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
Thread-safe component registration