other.go 441 B

1234567891011121314151617181920212223
  1. package initialize
  2. import (
  3. "github.com/songzhibin97/gkit/cache/local_cache"
  4. "lcfns/global"
  5. "lcfns/utils"
  6. )
  7. func OtherInit() {
  8. dr, err := utils.ParseDuration(global.Config.JWT.ExpiresTime)
  9. if err != nil {
  10. panic(err)
  11. }
  12. _, err = utils.ParseDuration(global.Config.JWT.BufferTime)
  13. if err != nil {
  14. panic(err)
  15. }
  16. //创建缓存,配置过期时间
  17. global.BlackCache = local_cache.NewCache(
  18. local_cache.SetDefaultExpire(dr),
  19. )
  20. }