fat(ttl): add permanent storage

This commit is contained in:
bandl 2021-11-03 12:40:58 +08:00
parent 5ee502021d
commit f5c3b0e1db
1 changed files with 5 additions and 0 deletions

View File

@ -20,6 +20,11 @@ func (l *lruTTl) setKeys(key *proto.BaseKey) int64 {
l.mu.Lock() l.mu.Lock()
defer l.mu.Unlock() defer l.mu.Unlock()
// 永久存储
if key.Expire == nil && key.Ttl == 0 {
return 0
}
ttlTime := time.Now().Unix() ttlTime := time.Now().Unix()
if key.Expire != nil { if key.Expire != nil {
ttlTime = key.Expire.GetSeconds() ttlTime = key.Expire.GetSeconds()