allegro / allegro/bigcache

Misleading name for config

Offen
#295 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
Go
Sterne
8.2k
Forks
614
Ø Merge
5 T. 12 Std.
Gemergte PRs (30 T.)
1

Beschreibung

`// initialShardSize computes initial shard size
func (c Config) initialShardSize() int {
return max(c.MaxEntriesInWindow/c.Shards, minimumEntriesInShard)
}

// maximumShardSize computes maximum shard size
func (c Config) maximumShardSize() int {
maxShardSize := 0

if c.HardMaxCacheSize > 0 {
maxShardSize = convertMBToBytes(c.HardMaxCacheSize) / c.Shards
}

return maxShardSize
}`

initialShardSize returns the number of entries in a shard while maximumShardSize returns the storage size of a shard which can be confirmed by the following usage

` entries: *queue.NewBytesQueue(config.initialShardSize()*config.MaxEntrySize, config.maximumShardSize(), config.Verbose),
`
config.MaxEntrySize is the storage size

If I didn't make it wrong I would suggest rename the functions as following:
initialShardSize -> initalEntriesNumsInSingleShards

"size" usually means the storage size and "number" usually means the count or number of something

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.