dashboard / erock/pico / feat(pgs): lru cache for object info and special files #59 rss

accepted · opened on 2025-04-06T03:01:44Z by erock
Help
checkout latest patchset:
ssh pr.pico.sh print pr-59 | git am -3
checkout any patchset in a patch request:
ssh pr.pico.sh print ps-X | git am -3
add changes to patch request:
git format-patch main --stdout | ssh pr.pico.sh pr add 59
add review to patch request:
git format-patch main --stdout | ssh pr.pico.sh pr add --review 59
accept PR:
ssh pr.pico.sh pr accept 59
close PR:
ssh pr.pico.sh pr close 59

Logs

erock created pr with ps-119 on 2025-04-06T03:01:44Z
erock added ps-120 on 2025-04-06T03:03:49Z
erock added ps-122 on 2025-04-06T19:08:31Z
erock added ps-123 on 2025-04-06T19:41:38Z
erock changed status on 2025-04-06T22:13:51Z {"status":"accepted"}

Patchsets

ps-119 by erock on 2025-04-06T03:01:44Z
Range Diff ↕ rd-120
1: 2cf56f0 ! 1: 26daea4 feat(pgs): lru cache for object info and special files
2: caace51 ! 2: b004b64 chore(pgs): use http cache clear event to rm lru cache for special files
ps-120 by erock on 2025-04-06T03:03:49Z
Range Diff ↕ rd-122
1: 26daea4 = 1: 26daea4 feat(pgs): lru cache for object info and special files
2: b004b64 = 2: b004b64 chore(pgs): use http cache clear event to rm lru cache for special files
-: ------- > 3: 59f5618 refactor(pgs): store lru cache on web router
ps-122 by erock on 2025-04-06T19:08:31Z
Range Diff ↕ rd-123
1: 26daea4 = 1: 26daea4 feat(pgs): lru cache for object info and special files
2: b004b64 = 2: b004b64 chore(pgs): use http cache clear event to rm lru cache for special files
3: 59f5618 = 3: 59f5618 refactor(pgs): store lru cache on web router
-: ------- > 4: ee12290 refactor(pgs): update minio lru and remove object info cache
ps-123 by erock on 2025-04-06T19:41:38Z

Range-diff rd-120

title
feat(pgs): lru cache for object info and special files
description
Patch changed
old #1
2cf56f0
new #1
26daea4
title
chore(pgs): use http cache clear event to rm lru cache for special files
description
Patch changed
old #2
caace51
new #2
b004b64
Back to top
1: 2cf56f0 ! 1: 26daea4 feat(pgs): lru cache for object info and special files

                    
pkg/cache/cache.go
+package cache
+
+import (
+	"log/slog"
+	"time"
+
+	"github.com/picosh/utils"
+)
+
+var CacheTimeout time.Duration
+
+func init() {
+	cacheDuration := utils.GetEnv("STORAGE_MINIO_CACHE_DURATION", "1m")
+	duration, err := time.ParseDuration(cacheDuration)
+	if err != nil {
+		slog.Error("Invalid STORAGE_MINIO_CACHE_DURATION value, using default 1m", "error", err)
+		duration = 1 * time.Minute
+	}
+
+	CacheTimeout = duration
+}
2: caace51 ! 2: b004b64 chore(pgs): use http cache clear event to rm lru cache for special files
pkg/cache/cache.go
+package cache
+
+import (
+	"log/slog"
+	"time"
+
+	"github.com/picosh/utils"
+)
+
+var CacheTimeout time.Duration
+
+func init() {
+	cacheDuration := utils.GetEnv("STORAGE_MINIO_CACHE_DURATION", "1m")
+	duration, err := time.ParseDuration(cacheDuration)
+	if err != nil {
+		slog.Error("Invalid STORAGE_MINIO_CACHE_DURATION value, using default 1m", "error", err)
+		duration = 1 * time.Minute
+	}
+
+	CacheTimeout = duration
+}