feat(cache): allow for non-expiring values

This commit is contained in:
Jan De Dobbeleer 2022-01-18 20:18:24 +01:00 committed by Jan De Dobbeleer
parent e5dd07fb9a
commit 3cca2104bb

View file

@ -60,6 +60,9 @@ func (fc *fileCache) get(key string) (string, bool) {
if !ok {
return "", false
}
if co.TTL <= 0 {
return co.Value, true
}
expired := time.Now().Unix() >= (co.Timestamp + int64(co.TTL)*60)
if expired {
fc.cache.remove(key)