41 lines
853 B
Go
41 lines
853 B
Go
|
package valkey
|
||
|
|
||
|
import (
|
||
|
"errors"
|
||
|
"github.com/valkey-io/valkey-go"
|
||
|
"github.com/valkey-io/valkey-go/valkeyhook"
|
||
|
"github.com/zeromicro/go-zero/core/syncx"
|
||
|
"time"
|
||
|
)
|
||
|
|
||
|
const (
|
||
|
// ClusterType means redis cluster.
|
||
|
ClusterType = "cluster"
|
||
|
// NodeType means redis node.
|
||
|
NodeType = "node"
|
||
|
// Nil is an alias of redis.Nil.
|
||
|
|
||
|
blockingQueryTimeout = 5 * time.Second
|
||
|
readWriteTimeout = 2 * time.Second
|
||
|
defaultSlowThreshold = time.Millisecond * 100
|
||
|
defaultPingTimeout = time.Second
|
||
|
)
|
||
|
|
||
|
var Nil = valkey.Nil
|
||
|
|
||
|
var (
|
||
|
// ErrNilNode is an error that indicates a nil redis node.
|
||
|
ErrNilNode = errors.New("nil redis node")
|
||
|
slowThreshold = syncx.ForAtomicDuration(defaultSlowThreshold)
|
||
|
)
|
||
|
|
||
|
type (
|
||
|
// VKNode interface represents a redis node.
|
||
|
VKNode interface {
|
||
|
valkey.CoreClient
|
||
|
}
|
||
|
|
||
|
// Hook is an alias of valkeyhook.Hook.
|
||
|
Hook = valkeyhook.Hook
|
||
|
)
|