为相关函数补充 context

This commit is contained in:
dragon
2025-08-18 16:28:13 +08:00
parent a385414e3f
commit d74e356975
10 changed files with 81 additions and 77 deletions

View File

@@ -13,9 +13,9 @@ import (
const TtlKeep = -1
type KVConfig interface {
Put(key string, value string, ttl time.Duration) error
Get(key string) (string, error)
Delete(key string) error
Put(ctx context.Context, key string, value string, ttl time.Duration) error
Get(ctx context.Context, key string) (string, error)
Delete(ctx context.Context, key string) error
io.Closer
}
@@ -48,7 +48,7 @@ func NewAutoConfig(src string) (KVConfig, error) {
if err != nil {
return nil, err
}
return NewConfigRedis(context.Background(), parse.Host, pass, dbi)
return NewConfigRedis(parse.Host, pass, dbi)
default:
return nil, fmt.Errorf("unsupported scheme: %s", parse.Scheme)
}