muesli / cache2go

Concurrency-safe Go caching library with expiration capabilities and access counters
Other
2.11k stars 516 forks source link

Maybe is problem with Less function although this function is unused. #8

Closed spring410 closed 7 years ago

spring410 commented 7 years ago

func (p CacheItemPairList) Less(i, j int) bool { return p[i].AccessCount > p[j].AccessCount }

I think it should be:

return p[i].AccessCount < p[j].AccessCount

Is that right?

muesli commented 7 years ago

It depends which way you want to sort slices. This is commonly used to sort the cache by most-accessed items, so this is correct.