muesli / cache2go

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

May I ask why using the go rountine in the time.AfterFunc, the param func should be run by an rountine #44

Closed leoxu1719 closed 4 years ago

leoxu1719 commented 4 years ago

https://github.com/muesli/cache2go/blob/4098a3aa8c94da4e28e868b5be85c42ad8d59214/cachetable.go#L166

leezhu commented 4 years ago

yes, it run by an routine, so it will not block the main gorotine. another goroutine will be time.AfterFunc to run when this expirationCheck func done. you can understand one cacheTable have only one expireationcheck func gorouting

muesli commented 4 years ago

I'm sorry but I don't fully understand the question. I hope @leezhu's response was helpful.