MCPcopy Create free account
hub / github.com/AdRoll/baker / moveToHotCache

Method moveToHotCache

pkg/buffercache/cache.go:344–354  ·  view source on GitHub ↗

moveToHotCache moves a buffer from the cold to the hot cache. loc represents the location of the buffer in the cold cache.

(key string, loc location)

Source from the content-addressed store, hash-verified

342// moveToHotCache moves a buffer from the cold to the hot cache.
343// loc represents the location of the buffer in the cold cache.
344func (c *BufferCache) moveToHotCache(key string, loc location) {
345 // Extract buffer and cell index from the location
346 bidx, cidx := loc.coldBucketIdx(), loc.coldCellIdx()
347
348 // Retrieve the log line
349 l, compressed := c.cold.buckets[bidx].get(cidx)
350 // Clear the corresponding cell in the bitmap
351 c.cold.buckets[bidx].freecells.clearBit(cidx)
352 c.putInHot(key, l, compressed)
353 c.m.m[key] = hotCacheLocation
354}
355
356// Metrics returns a snapshot of the cache performance counters.
357//

Callers 2

PutMethod · 0.95

Calls 5

putInHotMethod · 0.95
coldBucketIdxMethod · 0.80
coldCellIdxMethod · 0.80
clearBitMethod · 0.80
getMethod · 0.45

Tested by 1