@@ -30,7 +30,7 @@ const (
3030const shardCount = 1024
3131
3232type cacheSettings struct {
33- maxSize int32
33+ maxSize int64
3434 xlog io.Writer
3535 tagsEnabled bool
3636}
@@ -50,7 +50,7 @@ type Cache struct {
5050 settings atomic.Value // cacheSettings
5151
5252 stat struct {
53- size int32 // changing via atomic
53+ size int64 // changing via atomic
5454 queueBuildCnt uint32 // number of times writeout queue was built
5555 queueBuildTimeMs uint32 // time spent building writeout queue in milliseconds
5656 queueWriteoutTime uint32 // in milliseconds
@@ -129,10 +129,10 @@ func (c *Cache) SetWriteStrategy(s string) (err error) {
129129}
130130
131131// SetMaxSize of cache
132- func (c * Cache ) SetMaxSize (maxSize uint32 ) {
132+ func (c * Cache ) SetMaxSize (maxSize uint64 ) {
133133 s := c .settings .Load ().(* cacheSettings )
134134 newSettings := * s
135- newSettings .maxSize = int32 (maxSize )
135+ newSettings .maxSize = int64 (maxSize )
136136 c .settings .Store (& newSettings )
137137}
138138
@@ -274,8 +274,8 @@ func (c *Cache) NotConfirmedLength() int32 {
274274 return int32 (l )
275275}
276276
277- func (c * Cache ) Size () int32 {
278- return atomic .LoadInt32 (& c .stat .size )
277+ func (c * Cache ) Size () int64 {
278+ return atomic .LoadInt64 (& c .stat .size )
279279}
280280
281281func (c * Cache ) DivertToXlog (w io.Writer ) {
@@ -353,7 +353,7 @@ func (c *Cache) Add(p *points.Points) {
353353 }
354354
355355 }
356- atomic .AddInt32 (& c .stat .size , int32 (count ))
356+ atomic .AddInt64 (& c .stat .size , int64 (count ))
357357}
358358
359359// Pop removes an element from the map and returns it
@@ -366,7 +366,7 @@ func (c *Cache) Pop(key string) (p *points.Points, exists bool) {
366366 shard .Unlock ()
367367
368368 if exists {
369- atomic .AddInt32 (& c .stat .size , - int32 (len (p .Data )))
369+ atomic .AddInt64 (& c .stat .size , - int64 (len (p .Data )))
370370 }
371371
372372 return p , exists
@@ -390,7 +390,7 @@ func (c *Cache) PopNotConfirmed(key string) (p *points.Points, exists bool) {
390390 shard .Unlock ()
391391
392392 if exists {
393- atomic .AddInt32 (& c .stat .size , - int32 (len (p .Data )))
393+ atomic .AddInt64 (& c .stat .size , - int64 (len (p .Data )))
394394 }
395395
396396 return p , exists
0 commit comments