Skip to content

Commit

Permalink
Remove maxShardSize from BigCache (#294)
Browse files Browse the repository at this point in the history
Signed-off-by: Penthaa Patel <penthaapatel@gmail.com>
  • Loading branch information
penthaapatel committed Nov 2, 2021
1 parent c2b72fe commit 74e2db1
Showing 1 changed file with 14 additions and 16 deletions.
30 changes: 14 additions & 16 deletions bigcache.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,13 @@ const (
// It keeps entries on heap but omits GC for them. To achieve that, operations take place on byte arrays,
// therefore entries (de)serialization in front of the cache will be needed in most use cases.
type BigCache struct {
shards []*cacheShard
lifeWindow uint64
clock clock
hash Hasher
config Config
shardMask uint64
maxShardSize uint32
close chan struct{}
shards []*cacheShard
lifeWindow uint64
clock clock
hash Hasher
config Config
shardMask uint64
close chan struct{}
}

// Response will contain metadata about the entry for which GetWithInfo(key) was called
Expand Down Expand Up @@ -57,14 +56,13 @@ func newBigCache(config Config, clock clock) (*BigCache, error) {
}

cache := &BigCache{
shards: make([]*cacheShard, config.Shards),
lifeWindow: uint64(config.LifeWindow.Seconds()),
clock: clock,
hash: config.Hasher,
config: config,
shardMask: uint64(config.Shards - 1),
maxShardSize: uint32(config.maximumShardSizeInBytes()),
close: make(chan struct{}),
shards: make([]*cacheShard, config.Shards),
lifeWindow: uint64(config.LifeWindow.Seconds()),
clock: clock,
hash: config.Hasher,
config: config,
shardMask: uint64(config.Shards - 1),
close: make(chan struct{}),
}

var onRemove func(wrappedEntry []byte, reason RemoveReason)
Expand Down

0 comments on commit 74e2db1

Please sign in to comment.