From 3cca2104bb282a866b25aca01f97418331dd3997 Mon Sep 17 00:00:00 2001 From: Jan De Dobbeleer Date: Tue, 18 Jan 2022 20:18:24 +0100 Subject: [PATCH] feat(cache): allow for non-expiring values --- src/environment_cache.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/environment_cache.go b/src/environment_cache.go index a8b9d3df..3a2c0538 100644 --- a/src/environment_cache.go +++ b/src/environment_cache.go @@ -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)