fix: align cache controls with config

Remove unused head-check config, make TTL overrides explicit, and tighten revalidation to avoid stale cache behavior.
This commit is contained in:
2026-01-26 15:55:03 +08:00
parent 9a57949147
commit 40c6f2fcce
12 changed files with 58 additions and 38 deletions

View File

@@ -11,13 +11,14 @@ type StrategyOptions struct {
// ResolveStrategy 将模块的默认策略与 hub 级覆盖合并。
func ResolveStrategy(meta ModuleMetadata, opts StrategyOptions) CacheStrategyProfile {
strategy := meta.CacheStrategy
if strategy.TTLHint > 0 && opts.TTLOverride > 0 {
strategy.TTLHint = opts.TTLOverride
}
if opts.ValidationOverride != "" {
strategy.ValidationMode = opts.ValidationOverride
}
return normalizeStrategy(strategy)
strategy = normalizeStrategy(strategy)
if opts.TTLOverride > 0 {
strategy.TTLHint = opts.TTLOverride
}
return strategy
}
func normalizeStrategy(profile CacheStrategyProfile) CacheStrategyProfile {