@@ -11,9 +11,9 @@ import (
1111
1212// Internal cache errors
1313var (
14- ErrNotFound = errors .New ("Record not found" )
15- ErrDataLimit = errors .New ("Can't create new record, it violates data limit" )
16- ErrFullMemory = errors .New ("Can't create new rocord, memory is full" )
14+ ErrNotFound = errors .New ("record not found" )
15+ ErrDataLimit = errors .New ("cannot create new record: it violates data limit" )
16+ ErrFullMemory = errors .New ("cannot create new rocord: memory is full" )
1717)
1818
1919// Constans below are used for shard section identification.
@@ -116,7 +116,7 @@ func New(opts ...Option) *AtomicCache {
116116 cache := & AtomicCache {}
117117
118118 // Init lookup table
119- cache .lookup = btree .NewWithStringComparator (3 )
119+ cache .lookup = btree .NewWithStringComparator (16 )
120120
121121 // Init small shards section
122122 initShardsSection (& cache .smallShards , options .MaxShardsSmall , options .MaxRecords , options .RecordSizeSmall )
@@ -141,7 +141,7 @@ func New(opts ...Option) *AtomicCache {
141141func initShardsSection (shardsSection * ShardsLookup , maxShards , maxRecords , recordSize uint32 ) {
142142 var shardIndex uint32
143143
144- shardsSection .shards = make ([]* Shard , maxShards , maxShards )
144+ shardsSection .shards = make ([]* Shard , maxShards )
145145 for i := uint32 (0 ); i < maxShards ; i ++ {
146146 shardsSection .shardsAvail = append (shardsSection .shardsAvail , i )
147147 }
@@ -246,7 +246,7 @@ func (a *AtomicCache) releaseShard(shardSectionID uint8, shard uint32) bool {
246246 return false
247247 }
248248
249- if shardSection .shards [shard ].IsEmpty () == true {
249+ if shardSection .shards [shard ].IsEmpty () {
250250 shardSection .shards [shard ] = nil
251251
252252 shardSection .shardsAvail = append (shardSection .shardsAvail , shard )
0 commit comments