MCPcopy
hub / github.com/fish2018/pansou / SetBothLevels

Method SetBothLevels

util/cache/enhanced_two_level_cache.go:75–83  ·  view source on GitHub ↗

SetBothLevels 更新内存和磁盘缓存

(key string, data []byte, ttl time.Duration)

Source from the content-addressed store, hash-verified

73
74// SetBothLevels 更新内存和磁盘缓存
75func (c *EnhancedTwoLevelCache) SetBothLevels(key string, data []byte, ttl time.Duration) error {
76 now := time.Now()
77
78 // 同步更新内存缓存
79 c.memory.SetWithTimestamp(key, data, ttl, now)
80
81 // 同步更新磁盘缓存,确保数据立即写入
82 return c.disk.Set(key, data, ttl)
83}
84
85// SetWithFinalFlag 根据结果状态选择更新策略
86func (c *EnhancedTwoLevelCache) SetWithFinalFlag(key string, data []byte, ttl time.Duration, isFinal bool) error {

Callers 6

SetWithFinalFlagMethod · 0.95
initAppFunction · 0.80
NewSearchServiceFunction · 0.80
searchPluginsMethod · 0.80

Calls 2

SetWithTimestampMethod · 0.45
SetMethod · 0.45

Tested by

no test coverage detected