pub struct HandlerCache {
pub entries: HashMap<&'static str, HandlerEntry>,
pub entries_by_id: HashMap<TypeId, HandlerEntry>,
}Expand description
Runtime registry of compiled handler registrations.
Built at startup from HandlerRegistration inventory items.
Maps request type name to handler entry (factory + call bridge).
Unlike the previous design, entries do not cache a handler instance: the factory is invoked per request with the request-scoped resolver so Scoped dependencies (DbContext) are freshly owned each time.
Fields§
§entries: HashMap<&'static str, HandlerEntry>§entries_by_id: HashMap<TypeId, HandlerEntry>Implementations§
Source§impl HandlerCache
impl HandlerCache
Sourcepub fn build() -> HandlerCache
pub fn build() -> HandlerCache
Build the cache from all HandlerRegistration inventory items.
Sourcepub fn get_or_init() -> Arc<HandlerCache> ⓘ
👎Deprecated since 0.2.0: Prefer dispatch_handler_cache() within an active DispatchRuntime
pub fn get_or_init() -> Arc<HandlerCache> ⓘ
Prefer dispatch_handler_cache() within an active DispatchRuntime
Deprecated shim: lazy-build the process-wide handler registry.
Host::build() uses HandlerCache::build() per instance. This remains only
as a fallback for in-process Mediator::send without an active runtime.
Sourcepub fn get(&self, req_type_name: &str) -> Option<&HandlerEntry>
pub fn get(&self, req_type_name: &str) -> Option<&HandlerEntry>
Look up a handler entry by request type name (route / OpenAPI diagnostics).
Sourcepub fn get_by_type_id(&self, type_id: TypeId) -> Option<&HandlerEntry>
pub fn get_by_type_id(&self, type_id: TypeId) -> Option<&HandlerEntry>
Look up a handler entry by request type id (Mediator / in-process dispatch).