(vol, key string, data []byte, direct bool)
| 178 | } |
| 179 | |
| 180 | func (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 | |
| 199 | func (bm *bcacheManager) cacheDirect(vol, key string, data []byte) { |
| 200 | diskKv := bm.selectDiskKv(key) |
nothing calls this directly
no test coverage detected