muesli / cache2go

Concurrency-safe Go caching library with expiration capabilities and access counters

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

spring410 opened this issue · comments

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?

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.