feat(gallery): packing
This commit is contained in:
@@ -18,6 +18,8 @@ func Default() Cfg {
|
||||
},
|
||||
Cache: &Valkey{
|
||||
RefreshTime: time.Minute * 10,
|
||||
LifeTime: time.Hour * 48,
|
||||
},
|
||||
LogJSON: true,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user