1 Star 0 Fork 0

qp84/aiui-iot-core

加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
locker.go 725 Bytes
一键复制 编辑 原始数据 按行查看 历史
cnxkey 提交于 2025-02-15 16:55 +08:00 . *update lib
package config
import (
"gitee.com/qp84/aiui-iot-core/storage"
"gitee.com/qp84/aiui-iot-core/storage/locker"
"github.com/redis/go-redis/v9"
)
var LockerConfig = new(Locker)
type Locker struct {
Redis *RedisConnectOptions
}
// Empty 空设置
func (e Locker) Empty() bool {
return e.Redis == nil
}
// Setup 启用顺序 redis > 其他 > memory
func (e Locker) Setup() (storage.AdapterLocker, error) {
if e.Redis != nil {
client := GetRedisClient()
if client == nil {
options, err := e.Redis.GetRedisOptions()
if err != nil {
return nil, err
}
client = redis.NewClient(options)
_redis = client
}
return locker.NewRedis(client), nil
}
return nil, nil
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/qp84/aiui-iot-core.git
git@gitee.com:qp84/aiui-iot-core.git
qp84
aiui-iot-core
aiui-iot-core
v1.0.2

搜索帮助