cache.go 528 B

123456789101112131415161718192021222324
  1. // Author: simon (ynwdlxm@163.com)
  2. // Date: 2025/7/21 12:42
  3. // Desc:
  4. package bootstrap
  5. import (
  6. "fmt"
  7. "github.com/runningwater/gohub/pkg/cache"
  8. "github.com/runningwater/gohub/pkg/config"
  9. )
  10. func SetupCache() {
  11. // 初始化缓存的专用 redis client
  12. rds := cache.NewRedisStore(
  13. fmt.Sprintf("%v:%v", config.GetString("redis.host"), config.GetString("redis.port")),
  14. config.GetString("redis.username"),
  15. config.GetString("redis.password"),
  16. config.GetInt("redis.database_cache"),
  17. )
  18. cache.InitWithCacheStore(rds)
  19. }