diff --git a/cachetype_string.go b/cachetype_string.go index 7a93c371..abc5c2ee 100644 --- a/cachetype_string.go +++ b/cachetype_string.go @@ -19,7 +19,7 @@ var _CacheType_index = [...]uint8{0, 9, 17, 31} func (i CacheType) String() string { i -= 1 - if i < 0 || i >= CacheType(len(_CacheType_index)-1) { + if i >= CacheType(len(_CacheType_index)-1) { return "CacheType(" + strconv.FormatInt(int64(i+1), 10) + ")" } return _CacheType_name[_CacheType_index[i]:_CacheType_index[i+1]] diff --git a/galaxycache.go b/galaxycache.go index 3211a453..a0171146 100644 --- a/galaxycache.go +++ b/galaxycache.go @@ -592,7 +592,7 @@ func (g *Galaxy) populateCache(ctx context.Context, key string, value *valWithSt } // CacheType represents a type of cache. -type CacheType int +type CacheType uint8 const ( // MainCache is the cache for items that this peer is the @@ -627,12 +627,12 @@ func (g *Galaxy) CacheStats(which CacheType) CacheStats { // and counts the size of all keys and values. Candidate cache only // utilizes the lru.Cache and mutex, not the included stats. type cache struct { - ctype CacheType mu sync.Mutex nbytes int64 // of all keys and values lru *lru.Cache nhit, nget int64 nevict int64 // number of evictions + ctype CacheType } func (c *cache) stats() CacheStats {