modulepackage
1.0.10
Repository: https://github.com/kordar/goframework-redis.git
Documentation: pkg.go.dev
# README
goframework-redis
包装redis
对象,实现godb
接口。
安装
go get github.com/kordar/goframework-redis v1.0.8
使用
- 添加实例
// 1、通过配置添加
section := map[string]interface{}{
"addr": "127.0.0.1", // Redis地址
"password": "xxx", // Redis账号
"db": 12, // Redis库
"poolSize": 10, // Redis连接池大小
"maxRetries": 10, // 最大重试次数
"idleTimeout": 30, // 空闲链接超时时间(秒)
"minIdleConns": 3 // 空闲连接数量
}
if err := goframeworkredis.AddRedisInstance(key, section); err != nil {
log.Errorf("初始化redis异常,err=%v", err)
}
// 2、通过redis的option实现
var options redis.Options = ...
goframeworkredis.AddMysqlInstanceWithDsn(key, options)
# Functions
AddRedisInstance 添加redis句柄.
AddRedisInstances 批量添加redis句柄.
No description provided by the author
No description provided by the author
HasRedisInstance redis句柄是否存在.
No description provided by the author
No description provided by the author
RemoveRedisInstance 移除redis句柄.
# Structs
No description provided by the author