muesli / cache2go

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

Maybe expirationCheck() which in cachetable.go have a little issues? #15

Open Hu-Jiang opened 6 years ago

Hu-Jiang commented 6 years ago

In expirationCheck function, whether below code should in the function's end(), in other words , i mean in the table.Unlock()'s front ?

if table.cleanupInterval > 0 { table.log("Expiration check triggered after", table.cleanupInterval, "for table", table.name) } else { table.log("Expiration check installed for table", table.name) }

i think, if do this, the log message is more exact and reasonable.

wade0817wang commented 6 years ago

这段代码应该是表示当前这次的expirationCheck执行距离上次的Interval, 如果放在最后边,cleanupInterval就变成了当前这次距离下次的interval