Documentation ¶
Overview ¶
Package strategy defines different route strategy mode.
Index ¶
- Constants
- func IsWriteCommand(funcName string, args []interface{}) bool
- type CommandType
- type DoubleWriteStrategy
- func (d *DoubleWriteStrategy) AfterProcess(ctx context.Context, cmd redis.Cmder) error
- func (d *DoubleWriteStrategy) AfterProcessPipeline(ctx context.Context, cmds []redis.Cmder) error
- func (d *DoubleWriteStrategy) BeforeProcess(ctx context.Context, cmd redis.Cmder) (context.Context, error)
- func (d *DoubleWriteStrategy) BeforeProcessPipeline(ctx context.Context, cmds []redis.Cmder) (context.Context, error)
- func (a *DoubleWriteStrategy) Close() error
- func (d *DoubleWriteStrategy) RouteClient(opType CommandType) redis.UniversalClient
- func (d *DoubleWriteStrategy) Watch(ctx context.Context, fn func(*redis.Tx) error, keys ...string) error
- type LocalReadSingleWriteStrategy
- func (a *LocalReadSingleWriteStrategy) AfterProcess(ctx context.Context, cmd redis.Cmder) error
- func (a *LocalReadSingleWriteStrategy) AfterProcessPipeline(ctx context.Context, cmds []redis.Cmder) error
- func (a *LocalReadSingleWriteStrategy) BeforeProcess(ctx context.Context, cmd redis.Cmder) (context.Context, error)
- func (a *LocalReadSingleWriteStrategy) BeforeProcessPipeline(ctx context.Context, cmds []redis.Cmder) (context.Context, error)
- func (a *LocalReadSingleWriteStrategy) Close() error
- func (l *LocalReadSingleWriteStrategy) RouteClient(opType CommandType) redis.UniversalClient
- func (l *LocalReadSingleWriteStrategy) Watch(ctx context.Context, fn func(*redis.Tx) error, keys ...string) error
- type SingelReadDoubleWriteStrategy
- func (d *SingelReadDoubleWriteStrategy) AfterProcess(ctx context.Context, cmd redis.Cmder) error
- func (d *SingelReadDoubleWriteStrategy) AfterProcessPipeline(ctx context.Context, cmds []redis.Cmder) error
- func (d *SingelReadDoubleWriteStrategy) BeforeProcess(ctx context.Context, cmd redis.Cmder) (context.Context, error)
- func (d *SingelReadDoubleWriteStrategy) BeforeProcessPipeline(ctx context.Context, cmds []redis.Cmder) (context.Context, error)
- func (a *SingelReadDoubleWriteStrategy) Close() error
- func (d *SingelReadDoubleWriteStrategy) RouteClient(opType CommandType) redis.UniversalClient
- func (d *SingelReadDoubleWriteStrategy) Watch(ctx context.Context, fn func(*redis.Tx) error, keys ...string) error
- type SingleReadWriteStrategy
- func (a *SingleReadWriteStrategy) AfterProcess(ctx context.Context, cmd redis.Cmder) error
- func (a *SingleReadWriteStrategy) AfterProcessPipeline(ctx context.Context, cmds []redis.Cmder) error
- func (a *SingleReadWriteStrategy) BeforeProcess(ctx context.Context, cmd redis.Cmder) (context.Context, error)
- func (a *SingleReadWriteStrategy) BeforeProcessPipeline(ctx context.Context, cmds []redis.Cmder) (context.Context, error)
- func (a *SingleReadWriteStrategy) Close() error
- func (s *SingleReadWriteStrategy) RouteClient(opType CommandType) redis.UniversalClient
- func (s *SingleReadWriteStrategy) Watch(ctx context.Context, fn func(*redis.Tx) error, keys ...string) error
- type StrategyMode
Constants ¶
View Source
const ( SingleReadWriteMode = "single-read-write" LocalReadSingleWriteMode = "local-read-single-write" SingleReadDoubleWriteMode = "single-read-async-double-write" LocalReadDoubleWriteMode = "local-read-async-double-write" )
Variables ¶
This section is empty.
Functions ¶
func IsWriteCommand ¶ added in v1.0.4
Types ¶
type CommandType ¶ added in v1.0.4
type CommandType int32
const ( CommandTypeRead CommandType = iota CommandTypeWrite CommandTypeMulti CommandTypeOther )
type DoubleWriteStrategy ¶
type DoubleWriteStrategy struct {
// contains filtered or unexported fields
}
func (*DoubleWriteStrategy) AfterProcess ¶
func (d *DoubleWriteStrategy) AfterProcess(ctx context.Context, cmd redis.Cmder) error
func (*DoubleWriteStrategy) AfterProcessPipeline ¶
func (d *DoubleWriteStrategy) AfterProcessPipeline(ctx context.Context, cmds []redis.Cmder) error
func (*DoubleWriteStrategy) BeforeProcess ¶
func (*DoubleWriteStrategy) BeforeProcessPipeline ¶
func (*DoubleWriteStrategy) RouteClient ¶
func (d *DoubleWriteStrategy) RouteClient(opType CommandType) redis.UniversalClient
type LocalReadSingleWriteStrategy ¶
type LocalReadSingleWriteStrategy struct {
// contains filtered or unexported fields
}
func (*LocalReadSingleWriteStrategy) AfterProcess ¶
func (*LocalReadSingleWriteStrategy) AfterProcessPipeline ¶
func (*LocalReadSingleWriteStrategy) BeforeProcess ¶
func (*LocalReadSingleWriteStrategy) BeforeProcessPipeline ¶
func (*LocalReadSingleWriteStrategy) RouteClient ¶
func (l *LocalReadSingleWriteStrategy) RouteClient(opType CommandType) redis.UniversalClient
type SingelReadDoubleWriteStrategy ¶ added in v1.0.4
type SingelReadDoubleWriteStrategy struct {
DoubleWriteStrategy
}
func (*SingelReadDoubleWriteStrategy) AfterProcess ¶ added in v1.0.4
func (d *SingelReadDoubleWriteStrategy) AfterProcess(ctx context.Context, cmd redis.Cmder) error
func (*SingelReadDoubleWriteStrategy) AfterProcessPipeline ¶ added in v1.0.4
func (d *SingelReadDoubleWriteStrategy) AfterProcessPipeline(ctx context.Context, cmds []redis.Cmder) error
func (*SingelReadDoubleWriteStrategy) BeforeProcess ¶ added in v1.0.4
func (*SingelReadDoubleWriteStrategy) BeforeProcessPipeline ¶ added in v1.0.4
func (*SingelReadDoubleWriteStrategy) Close ¶ added in v1.0.4
func (a *SingelReadDoubleWriteStrategy) Close() error
func (*SingelReadDoubleWriteStrategy) RouteClient ¶ added in v1.0.4
func (d *SingelReadDoubleWriteStrategy) RouteClient(opType CommandType) redis.UniversalClient
type SingleReadWriteStrategy ¶
type SingleReadWriteStrategy struct {
// contains filtered or unexported fields
}
func (*SingleReadWriteStrategy) AfterProcess ¶
func (*SingleReadWriteStrategy) AfterProcessPipeline ¶
func (*SingleReadWriteStrategy) BeforeProcess ¶
func (*SingleReadWriteStrategy) BeforeProcessPipeline ¶
func (*SingleReadWriteStrategy) RouteClient ¶
func (s *SingleReadWriteStrategy) RouteClient(opType CommandType) redis.UniversalClient
type StrategyMode ¶
type StrategyMode interface { RouteClient(opType CommandType) redis.UniversalClient Close() error Watch(ctx context.Context, fn func(*redis.Tx) error, keys ...string) error }
func NewStrategy ¶
func NewStrategy(configuration *config.Configuration) StrategyMode
Click to show internal directories.
Click to hide internal directories.