Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetCacheStats ¶
func GetCacheStats() common.DiskCacheStats
GetCacheStats 获取缓存统计信息(代理到 common 包)
func UpdateAndSync ¶
func UpdateAndSync()
UpdateAndSync 把当前配置代同步到 common 包投影。
生效语义(与 docs/FULL_PRERELEASE_EXECUTION_PLAN.md D14/D15 合同一致):
- 热字段(disk_cache_enabled / disk_cache_threshold_mb、monitor_*)保存后 立即对“新决策/新请求”生效;
- 磁盘放置字段(disk_cache_path / disk_cache_max_size_mb)只更新配置代, 不迁移正在使用的磁盘缓存;须通过维护重建端点 (POST /api/option/disk_cache/rebuild,最终调用 common.RebuildDiskCache) 或进程重启才会进入生效代。禁止在普通保存路径上偷偷换目录写文件。
当配置从数据库加载或经保存通道更新后,需要调用此函数同步。
Types ¶
type PerformanceSetting ¶
type PerformanceSetting struct {
// DiskCacheEnabled 是否启用磁盘缓存(磁盘换内存)
DiskCacheEnabled bool `json:"disk_cache_enabled"`
// DiskCacheThresholdMB 触发磁盘缓存的请求体大小阈值(MB)
DiskCacheThresholdMB int `json:"disk_cache_threshold_mb"`
// DiskCacheMaxSizeMB 磁盘缓存最大总大小(MB)
DiskCacheMaxSizeMB int `json:"disk_cache_max_size_mb"`
// DiskCachePath 磁盘缓存目录
DiskCachePath string `json:"disk_cache_path"`
// MonitorEnabled 是否启用性能监控
MonitorEnabled bool `json:"monitor_enabled"`
// MonitorCPUThreshold CPU 使用率阈值(%)
MonitorCPUThreshold int `json:"monitor_cpu_threshold"`
// MonitorMemoryThreshold 内存使用率阈值(%)
MonitorMemoryThreshold int `json:"monitor_memory_threshold"`
// MonitorDiskThreshold 磁盘使用率阈值(%)
MonitorDiskThreshold int `json:"monitor_disk_threshold"`
}
PerformanceSetting 性能设置配置
func GetPerformanceSetting ¶
func GetPerformanceSetting() *PerformanceSetting
GetPerformanceSetting 获取性能设置的分离快照。 返回值是当代配置的副本,调用方修改它不会影响运行时状态; 后续保存产生的新代不会渗透进已取出的快照。
Click to show internal directories.
Click to hide internal directories.