interfaces
v9.24.1
github.com/redis/go-redis/v9/internal/interfaces
Documentation
pkg.go.dev ↗Package interfaces provides shared interfaces used by both the main redis package and the maintnotifications upgrade package to avoid circular dependencies.
Types
ClientInterface
type ClientInterface interface {
// GetOptions returns the client options.
GetOptions() OptionsInterface
// GetPushProcessor returns the client's push notification processor.
GetPushProcessor() NotificationProcessor
}
ClientInterface defines the interface that clients must implement for maintnotifications upgrades.
NotificationProcessor
type NotificationProcessor interface {
RegisterHandler(pushNotificationName string, handler interface{}, protected bool) error
UnregisterHandler(pushNotificationName string) error
GetHandler(pushNotificationName string) interface{}
}
NotificationProcessor is (most probably) a push.NotificationProcessor forward declaration to avoid circular imports
OptionsInterface
type OptionsInterface interface {
// GetReadTimeout returns the read timeout.
GetReadTimeout() time.Duration
// GetWriteTimeout returns the write timeout.
GetWriteTimeout() time.Duration
// GetNetwork returns the network type.
GetNetwork() string
// GetAddr returns the connection address.
GetAddr() string
// GetNodeAddress returns the address of the Redis node as reported by the server.
// For cluster clients, this is the endpoint from CLUSTER SLOTS before any transformation.
// For standalone clients, this defaults to Addr.
GetNodeAddress() string
// IsTLSEnabled returns true if TLS is enabled.
IsTLSEnabled() bool
// GetProtocol returns the protocol version.
GetProtocol() int
// GetPoolSize returns the connection pool size.
GetPoolSize() int
// NewDialer returns a new dialer function for the connection.
NewDialer() func(context.Context) (net.Conn, error)
}
OptionsInterface defines the interface for client options. Uses an adapter pattern to avoid circular dependencies.