MCPcopy
hub / github.com/cubefs/cubefs / cache

Method cache

client/blockcache/bcache/manage.go:180–197  ·  view source on GitHub ↗
(vol, key string, data []byte, direct bool)

Source from the content-addressed store, hash-verified

178}
179
180func (bm *bcacheManager) cache(vol, key string, data []byte, direct bool) {
181 bgTime := stat.BeginStat()
182 defer func() {
183 stat.EndStat("Cache:Write", nil, bgTime, 1)
184 stat.StatBandWidth("Cache", uint32(len(data)))
185 }()
186 log.LogDebugf("TRACE cache. key(%v) len(%v) direct(%v)", key, len(data), direct)
187 if direct {
188 bm.cacheDirect(vol, key, data)
189 return
190 }
191 select {
192 case bm.pending <- waitFlush{Key: key, Data: data}:
193 default:
194 log.LogDebugf("pending chan is full,skip memory. key =%v,len=%v bytes", key, len(data))
195 bm.cacheDirect(vol, key, data)
196 }
197}
198
199func (bm *bcacheManager) cacheDirect(vol, key string, data []byte) {
200 diskKv := bm.selectDiskKv(key)

Callers

nothing calls this directly

Calls 5

cacheDirectMethod · 0.95
BeginStatFunction · 0.92
EndStatFunction · 0.92
StatBandWidthFunction · 0.92
LogDebugfFunction · 0.92

Tested by

no test coverage detected