Documentation
¶
Index ¶
- Constants
- Variables
- func GetUniversalOptions(p *RedisProperties, opts ...ConnOptions) (*redis.UniversalOptions, error)
- func NewRedisTrackingHook(tracer opentracing.Tracer) *redisTracingHook
- func Use()
- type Client
- type ClientFactory
- type ClientOption
- type ClientOptions
- type ConnOptions
- type FactoryOption
- type FactoryOptions
- type OptionsAwareHook
- type RedisHealthIndicator
- type RedisProperties
- type TLSProperties
Constants ¶
View Source
const ( ConfigRootRedisConnection = "redis" DefaultDbIndex = 0 )
View Source
const KeepTTL = redis.KeepTTL
KeepTTL is an option for Set command to keep key's existing TTL. For example:
rdb.Set(ctx, key, value, redis.KeepTTL)
Variables ¶
Functions ¶
func GetUniversalOptions ¶
func GetUniversalOptions(p *RedisProperties, opts ...ConnOptions) (*redis.UniversalOptions, error)
func NewRedisTrackingHook ¶ added in v0.14.0
func NewRedisTrackingHook(tracer opentracing.Tracer) *redisTracingHook
Types ¶
type ClientFactory ¶
type ClientFactory interface {
// New returns a newly created Client
New(ctx context.Context, opts ...ClientOptions) (Client, error)
// AddHooks add hooks to all Client already created and any future Client created via this interface
// If the given hook also implments OptionsAwareHook, the method will be used to derive a hook instance and added to
// coresponding client
AddHooks(ctx context.Context, hooks ...redis.Hook)
}
func NewClientFactory ¶
func NewClientFactory(opts ...FactoryOptions) ClientFactory
type ClientOption ¶
type ClientOption struct {
DbIndex int
}
type ClientOptions ¶
type ClientOptions func(opt *ClientOption)
type ConnOptions ¶
type ConnOptions func(opt *redis.UniversalOptions) error
ConnOptions options for connectivity by manipulating redis.UniversalOptions
type FactoryOption ¶
type FactoryOption struct {
Properties RedisProperties
TLSCertsManager certs.Manager
}
type FactoryOptions ¶
type FactoryOptions func(opt *FactoryOption)
type OptionsAwareHook ¶
type OptionsAwareHook interface {
redis.Hook
WithClientOption(*redis.UniversalOptions) redis.Hook
}
type RedisHealthIndicator ¶
type RedisHealthIndicator struct {
// contains filtered or unexported fields
}
func (*RedisHealthIndicator) Name ¶
func (i *RedisHealthIndicator) Name() string
type RedisProperties ¶
type RedisProperties struct {
// Either a single address or a seed list of host:port addresses
// of cluster/sentinel nodes.
Addresses utils.CommaSeparatedSlice `json:"addrs"`
// Database to be selected after connecting to the server.
// Only single-node and failover clients.
DB int `json:"db"`
// Common options.
Username string `json:"username"`
Password string `json:"password"`
MaxRetries int `json:"max-retries"`
MinRetryBackoff time.Duration `json:"min-retry-backoff"`
MaxRetryBackoff time.Duration `json:"max-retry-backoff"`
DialTimeout time.Duration `json:"dial-timeout"`
ReadTimeout time.Duration `json:"read-timeout"`
WriteTimeout time.Duration `json:"write-timeout"`
PoolSize int `json:"pool-size"`
MinIdleConns int `json:"min-idle-conns"`
MaxConnAge time.Duration `json:"max-conn-age"`
PoolTimeout time.Duration `json:"pool-timeout"`
IdleTimeout time.Duration `json:"idle-timeout"`
IdleCheckFrequency time.Duration `json:"idle-check-frequency"`
// TLS Properties for Redis
TLS TLSProperties `json:"tls"`
MaxRedirects int `json:"max-redirects"`
ReadOnly bool `json:"read-only"`
RouteByLatency bool `json:"route-by-latency"`
RouteRandomly bool `json:"route-randomly"`
// The sentinel master name.
// Only failover clients.
MasterName string `json:"master-name"`
SentinelPassword string `json:"sentinel-password"`
}
func BindRedisProperties ¶
func BindRedisProperties(ctx *bootstrap.ApplicationContext) RedisProperties
type TLSProperties ¶
type TLSProperties struct {
Enabled bool `json:"enabled"`
Certs certs.SourceProperties `json:"certs"`
}
Click to show internal directories.
Click to hide internal directories.