feat(images): cache lifetime in config
/ publish (push) Successful in 3m43s

This commit is contained in:
2026-03-19 22:10:20 +01:00
parent b384c70c39
commit ee3eba3cd9
4 changed files with 12 additions and 7 deletions
+1 -2
View File
@@ -13,7 +13,6 @@ import (
_ "image/png"
"io"
"strings"
"time"
_ "golang.org/x/image/webp"
@@ -98,7 +97,7 @@ func (s *Service) GetImage(ctx context.Context, uid string, options Options) (im
if err != nil {
return
}
if err = s.cache.Do(ctx, s.cache.B().Set().Key("img:"+hash).Value(valkey.BinaryString(outBuff.Bytes())).Ex(time.Hour*48).Build()).Error(); err == nil {
if err = s.cache.Do(ctx, s.cache.B().Set().Key("img:"+hash).Value(valkey.BinaryString(outBuff.Bytes())).Ex(s.cfg.CacheLifetime).Build()).Error(); err == nil {
return outBuff, "image/jpeg", err
}