INNER CODE UNIT · Go
shardCount
go-graphite/go-carbon · cache/cache.go:28
const shardCount = 1 << 10 // 1024 - an arbitrary sized power of 2
type cacheSettings struct {
maxSize int64
xlog io.Writer
tagsEnabled bool
}
// A "thread" safe map of type string:Anything.
// To avoid lock bottlenecks this map is dived to several (shardCount) map shards.
type Cache struct {
mu sync.Mutex
queueLastBuild time.Time
data []*Shard
writeStrategy WriteStrategy