分享码有效期,支持表达式
This commit is contained in:
+3
-2
@@ -78,6 +78,7 @@ func main() {
|
||||
zap.Int("port", cfg.Redis.Port),
|
||||
zap.Int("db", cfg.Redis.Database),
|
||||
)
|
||||
log.Info("share code ttl configured", zap.Duration("ttl", cfg.ShareCodeTTL))
|
||||
|
||||
// 启动时预热缓存
|
||||
warmUpCache(log, db, rdb)
|
||||
@@ -88,7 +89,7 @@ func main() {
|
||||
devicePersistTask := task.NewDevicePersistTask(rdb, deviceRepo, log)
|
||||
devicePersistTask.Start(5 * time.Minute)
|
||||
|
||||
shareCodeCache := cache.NewShareCodeCache(rdb, time.Duration(cfg.ShareCodeTTLMin)*time.Minute)
|
||||
shareCodeCache := cache.NewShareCodeCache(rdb, cfg.ShareCodeTTL)
|
||||
shareCodeRepo := repository.NewShareCodeRepository(db)
|
||||
shareCodePersistTask := task.NewShareCodePersistTask(shareCodeCache, shareCodeRepo, log)
|
||||
shareCodePersistTask.Start(5 * time.Minute)
|
||||
@@ -105,7 +106,7 @@ func main() {
|
||||
zap.String("region", cfg.S3.Region),
|
||||
)
|
||||
|
||||
engine := router.New(log, db, searchClient, rdb, cfg.Equalize, s3Storage, cfg.ShareCodeMaxPerMac, time.Duration(cfg.ShareCodeTTLMin)*time.Minute, cfg.Env)
|
||||
engine := router.New(log, db, searchClient, rdb, cfg.Equalize, s3Storage, cfg.ShareCodeMaxPerMac, cfg.ShareCodeTTL, cfg.Env)
|
||||
|
||||
srv := &http.Server{
|
||||
Addr: cfg.Addr(),
|
||||
|
||||
Reference in New Issue
Block a user