```
feat(database): 新增数据库初始化函数 新增 NewDatabase 函数,支持根据驱动类型初始化 MySQL 或 Postgres 数据库连接。 该函数根据传入的驱动名称自动路由到对应的数据库连接创建逻辑,并提供错误处理。 ```
This commit is contained in:
16
with/cache.go
Normal file
16
with/cache.go
Normal file
@@ -0,0 +1,16 @@
|
||||
package with
|
||||
|
||||
import (
|
||||
"git.apinb.com/bsm-sdk/core/cache/redis"
|
||||
"git.apinb.com/bsm-sdk/core/print"
|
||||
"git.apinb.com/bsm-sdk/core/vars"
|
||||
)
|
||||
|
||||
func RedisCache(cfg string, cli *redis.RedisClient) {
|
||||
if cfg != "" {
|
||||
cli = redis.New(cfg, vars.ServiceKey)
|
||||
|
||||
// print inform.
|
||||
print.Info("[BSM - %s] Cache: %s, DBIndex: %d", vars.ServiceKey, cfg, cli.DB)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user