Documentation
¶
Index ¶
- Variables
- func NewNoop() *noopClient
- type Client
- type ClusterConfig
- type Command
- type Config
- type Endpoint
- type Mode
- type OperationEvent
- type OperationHook
- type OperationHookFuncs
- type Option
- func WithAddress(address string) Option
- func WithCluster(addrs ...string) Option
- func WithDatabase(database int) Option
- func WithNamespace(namespace string) Option
- func WithOperationHooks(hooks ...OperationHook) Option
- func WithPool(pool PoolConfig) Option
- func WithRetry(retry RetryConfig) Option
- func WithTLS(tls TLSConfig) Option
- func WithTimeouts(timeout TimeoutConfig) Option
- type Options
- type Pipeline
- type PipelineError
- type PoolConfig
- type Result
- type RetryConfig
- type Stats
- type Statser
- type TLSConfig
- type TimeoutConfig
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrNotConfigured = errors.New("redis not configured")
View Source
var ErrPipelineFailed = errors.New("redis pipeline failed")
Functions ¶
Types ¶
type Client ¶
type Client interface {
Get(ctx context.Context, key string) ([]byte, error)
MGet(ctx context.Context, keys ...string) (map[string][]byte, error)
Set(ctx context.Context, key string, value []byte, ttl time.Duration) error
MSet(ctx context.Context, values map[string][]byte, ttl time.Duration) error
Delete(ctx context.Context, key string) error
Pipeline(ctx context.Context, commands ...Command) ([]Result, error)
}
type ClusterConfig ¶
type Config ¶
type Config struct {
Mode Mode
Endpoint Endpoint
Cluster ClusterConfig
Pool PoolConfig
Retry RetryConfig
Timeout TimeoutConfig
TLS TLSConfig
Namespace string
}
type OperationEvent ¶
type OperationEvent struct {
Name string
Key string
Keys []string
CommandCount int
StartedAt time.Time
Duration time.Duration
Err error
}
func (OperationEvent) Clone ¶
func (e OperationEvent) Clone() OperationEvent
type OperationHook ¶
type OperationHook interface {
BeforeRedis(ctx context.Context, event OperationEvent) context.Context
AfterRedis(ctx context.Context, event OperationEvent)
}
type OperationHookFuncs ¶
type OperationHookFuncs struct {
Before func(ctx context.Context, event OperationEvent) context.Context
After func(ctx context.Context, event OperationEvent)
}
func (OperationHookFuncs) AfterRedis ¶
func (h OperationHookFuncs) AfterRedis(ctx context.Context, event OperationEvent)
func (OperationHookFuncs) BeforeRedis ¶
func (h OperationHookFuncs) BeforeRedis(ctx context.Context, event OperationEvent) context.Context
type Option ¶
type Option func(*Options)
func WithAddress ¶
func WithCluster ¶
func WithDatabase ¶
func WithNamespace ¶
func WithOperationHooks ¶
func WithOperationHooks(hooks ...OperationHook) Option
func WithPool ¶
func WithPool(pool PoolConfig) Option
func WithRetry ¶
func WithRetry(retry RetryConfig) Option
func WithTimeouts ¶
func WithTimeouts(timeout TimeoutConfig) Option
type Options ¶
type Options struct {
Address string
Addrs []string
Database int
Namespace string
Cluster ClusterConfig
Pool PoolConfig
Retry RetryConfig
Timeout TimeoutConfig
TLS TLSConfig
Hooks []OperationHook
}
func NewOptions ¶
type PipelineError ¶
type PipelineError struct {
Results []Result
}
func (PipelineError) Error ¶
func (e PipelineError) Error() string
func (PipelineError) Is ¶
func (e PipelineError) Is(target error) bool
func (PipelineError) Unwrap ¶
func (e PipelineError) Unwrap() error
type PoolConfig ¶
type RetryConfig ¶
type Stats ¶
Click to show internal directories.
Click to hide internal directories.