add redis init status log (#1867)

Co-authored-by: Kent Dong <ch3cho@qq.com>
This commit is contained in:
rinfx
2025-03-10 17:10:53 +08:00
committed by GitHub
parent b897825069
commit 9e2df8f7c7
6 changed files with 29 additions and 9 deletions

View File

@@ -30,6 +30,8 @@ type RedisResponseCallback func(response resp.Value)
type RedisClient interface {
Init(username, password string, timeout int64, opts ...optionFunc) error
// return whether redis client is ready
Ready() bool
// with this function, you can call redis as if you are using redis-cli
Command(cmds []interface{}, callback RedisResponseCallback) error
Eval(script string, numkeys int, keys, args []interface{}, callback RedisResponseCallback) error
@@ -183,6 +185,10 @@ func respString(args []interface{}) []byte {
return buf.Bytes()
}
func (c *RedisClusterClient[C]) Ready() bool {
return c.ready
}
func (c *RedisClusterClient[C]) Init(username, password string, timeout int64, opts ...optionFunc) error {
for _, opt := range opts {
opt(&c.option)