26 lines
695 B
Go
26 lines
695 B
Go
// Package impl 沿用 sample/server 创建 IoT 进程所需的基础设施实例。
|
|
package impl
|
|
|
|
import (
|
|
"git.apinb.com/bsm-sdk/core/cache/redis"
|
|
"git.apinb.com/bsm-sdk/core/logger"
|
|
"git.apinb.com/bsm-sdk/core/with"
|
|
"git.apinb.com/heqiapp/platforms/backend/iot/internal/config"
|
|
"github.com/patrickmn/go-cache"
|
|
"gorm.io/gorm"
|
|
)
|
|
|
|
var (
|
|
RedisService *redis.RedisClient
|
|
DBService *gorm.DB
|
|
MemoryService *cache.Cache
|
|
)
|
|
|
|
// NewImpl 初始化 MQTT Mock 进程共用的数据库、缓存、Redis 与日志。
|
|
func NewImpl() {
|
|
MemoryService = with.Memory(nil)
|
|
RedisService = with.RedisCache(config.Spec.Cache)
|
|
DBService = with.Databases(config.Spec.Databases, nil)
|
|
logger.New(nil)
|
|
}
|