From f5c3b0e1dbbaeb3b04f8acca861cf3bae8d9f2ad Mon Sep 17 00:00:00 2001 From: bandl <1658002533@qq.com> Date: Wed, 3 Nov 2021 12:40:58 +0800 Subject: [PATCH] fat(ttl): add permanent storage --- pkg/lru/ttl.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkg/lru/ttl.go b/pkg/lru/ttl.go index 189aa3f..23319e2 100644 --- a/pkg/lru/ttl.go +++ b/pkg/lru/ttl.go @@ -20,6 +20,11 @@ func (l *lruTTl) setKeys(key *proto.BaseKey) int64 { l.mu.Lock() defer l.mu.Unlock() + // 永久存储 + if key.Expire == nil && key.Ttl == 0 { + return 0 + } + ttlTime := time.Now().Unix() if key.Expire != nil { ttlTime = key.Expire.GetSeconds()