From f8c9b19a624b23ac633d1c34ceb206b7adebe54d Mon Sep 17 00:00:00 2001 From: huangpeizhi2018 <42397138+huangpeizhi2018@users.noreply.github.com> Date: Sat, 8 Sep 2018 18:12:09 +0800 Subject: [PATCH] fix checkExpireCallback panic --- cache.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cache.go b/cache.go index 45dcc2b..2a09a08 100644 --- a/cache.go +++ b/cache.go @@ -87,6 +87,9 @@ func (cache *Cache) startExpirationProcessing() { if !cache.checkExpireCallback(item.key, item.data) { item.touch() cache.priorityQueue.update(item) + if cache.priorityQueue.Len() == 1 { + goto done + } i++ continue }