Class TenantConfigManager
java.lang.Object
cloud.opencode.base.config.advanced.TenantConfigManager
Multi-Tenant Configuration Manager
多租户配置管理器
Manages configuration for multiple tenants with inheritance from base configuration. Each tenant can have its own configuration that overrides the base configuration.
管理多租户配置,支持从基础配置继承。每个租户可以有自己的配置覆盖基础配置。
Features | 主要功能:
- Tenant-specific configuration - 租户特定配置
- Base configuration inheritance - 基础配置继承
- Lazy loading per tenant - 每个租户的懒加载
- Thread-safe tenant cache - 线程安全的租户缓存
Usage Examples | 使用示例:
TenantConfigManager manager = new TenantConfigManager(OpenConfig.getGlobal());
// Get tenant-specific configuration
Config tenantConfig = manager.getConfig("tenant-123");
String apiKey = tenantConfig.getString("api.key");
// Or directly get typed value
String apiKey = manager.get("tenant-123", "api.key", String.class);
Security | 安全性:
- Thread-safe: Yes - 线程安全: 是
- Tenant isolation: Configuration level - 租户隔离: 配置级别
- Since:
- JDK 25, opencode-base-config V1.0.0
- Author:
- Leon Soo www.LeonSoo.com
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionTenantConfigManager(Config baseConfig) Create tenant config manager with base configuration 使用基础配置创建租户配置管理器 -
Method Summary
Modifier and TypeMethodDescriptionvoidClear all cached configurations 清除所有缓存配置voidclearCache(String tenantId) Clear cached configuration for tenant 清除租户的缓存配置<T> TGet typed configuration value for tenant 获取租户的类型化配置值Get configuration for tenant 获取租户的配置
-
Constructor Details
-
TenantConfigManager
Create tenant config manager with base configuration 使用基础配置创建租户配置管理器- Parameters:
baseConfig- base configuration | 基础配置
-
-
Method Details
-
getConfig
-
get
-
clearCache
Clear cached configuration for tenant 清除租户的缓存配置- Parameters:
tenantId- tenant identifier | 租户标识符
-
clearAllCaches
public void clearAllCaches()Clear all cached configurations 清除所有缓存配置
-