feat(gallery): packing

This commit is contained in:
2026-05-31 15:48:18 +02:00
parent 9282f1f634
commit 8a72b96e66
12 changed files with 126 additions and 19 deletions
+2
View File
@@ -18,6 +18,8 @@ func Default() Cfg {
},
Cache: &Valkey{
RefreshTime: time.Minute * 10,
LifeTime: time.Hour * 48,
},
LogJSON: true,
}
}
+2
View File
@@ -16,6 +16,7 @@ type Cfg struct {
Gallery *Gallery `env:", prefix=GALLERY_"`
LogLevel slog.Level `env:"LOG_LEVEL, default=DEBUG"`
LogJSON bool `env:"LOG_JSON"`
}
type WebdavConfig struct {
@@ -30,6 +31,7 @@ type Valkey struct {
Password string `env:"PASSWORD"`
RefreshTime time.Duration `env:"REFRESH_TIME"`
LifeTime time.Duration `env:"REFRESH_TIME"`
// InitAddress point to valkey nodes.
// Valkey will connect to them one by one and issue a CLUSTER SLOT command to initialize the cluster client until success.
+2 -2
View File
@@ -23,11 +23,11 @@ type CachedClient struct {
}
// NewCachedClient creates a new CachedClient.
func NewCachedClient(impl FS, client valkey.Client, refreshtime time.Duration) *CachedClient {
func NewCachedClient(impl FS, client valkey.Client, refreshtime time.Duration, lifetime time.Duration) *CachedClient {
c := &CachedClient{
impl: impl,
cache: client,
ttl: refreshtime * 5,
ttl: lifetime,
}
go func() {