feat(plugin): Schema 缓存 — moka LRU Cache 消除 resolve_entity_info 重复查库
- 添加 moka 0.12 依赖到 erp-plugin 和 erp-server - 重写 state.rs: 新增 EntityInfo (含 generated_fields) 和 moka Cache - AppState 新增 plugin_entity_cache 字段 - data_service.rs: 旧 resolve_entity_info 保留兼容,新增 resolve_entity_info_cached
This commit is contained in:
@@ -18,6 +18,8 @@ pub struct AppState {
|
||||
pub default_tenant_id: uuid::Uuid,
|
||||
/// 插件引擎
|
||||
pub plugin_engine: erp_plugin::engine::PluginEngine,
|
||||
/// 插件实体缓存
|
||||
pub plugin_entity_cache: moka::sync::Cache<String, erp_plugin::state::EntityInfo>,
|
||||
}
|
||||
|
||||
/// Allow handlers to extract `DatabaseConnection` directly from `State<AppState>`.
|
||||
@@ -90,6 +92,7 @@ impl FromRef<AppState> for erp_plugin::state::PluginState {
|
||||
db: state.db.clone(),
|
||||
event_bus: state.event_bus.clone(),
|
||||
engine: state.plugin_engine.clone(),
|
||||
entity_cache: state.plugin_entity_cache.clone(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user