27 lines
683 B
Go
27 lines
683 B
Go
package impl
|
|
|
|
import (
|
|
"git.apinb.com/bsm-sdk/core/cache/redis"
|
|
"git.apinb.com/bsm-sdk/core/with"
|
|
"git.apinb.com/pro/rbac2/internal/config"
|
|
"github.com/allegro/bigcache/v3"
|
|
"git.apinb.com/bsm-sdk/core/with"
|
|
)
|
|
|
|
var (
|
|
RedisService *redis.RedisClient // Redis 客户端服务
|
|
MemoryService *bigcache.BigCache // 内存缓存服务
|
|
)
|
|
|
|
// NewImpl 初始化各类服务实例
|
|
func NewImpl() {
|
|
// 初始化内存缓存
|
|
MemorySerice = with.Memory(nil)
|
|
// 初始化 Redis 缓存
|
|
RedisService = with.RedisCache(config.Spec.Cache)
|
|
// 初始化数据库服务
|
|
DBService = with.Databases(config.Spec.Databases, nil) // model
|
|
// 初始化日志服务
|
|
with.Logger(config.Spec.Log)
|
|
}
|