Documentation ¶
Index ¶
- func NewRedisClientWithLoadbalancer(addrs []string, opt *redis.Options) (*redis.Client, *loadbalancer)
- func NewRedisLoadbalancer(addrs []string, opt redis.Options) *loadbalancer
- type RedisBackend
- func (r *RedisBackend) Close() error
- func (r *RedisBackend) GetLocks(group string) (int, error)
- func (r *RedisBackend) GetStaleLocks(ts time.Duration) ([]types.Lock, error)
- func (r *RedisBackend) HasLock(group string, id string) (bool, error)
- func (r *RedisBackend) Release(group string, id string) error
- func (r *RedisBackend) Reserve(group string, id string) error
- type RedisConfig
- type RedisSentinelConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewRedisClientWithLoadbalancer ¶ added in v1.2.0
func NewRedisClientWithLoadbalancer(addrs []string, opt *redis.Options) (*redis.Client, *loadbalancer)
Create a new redis client with loadbalanced connections
func NewRedisLoadbalancer ¶ added in v1.2.0
func NewRedisLoadbalancer(addrs []string, opt redis.Options) *loadbalancer
Return a new loadbalancer for redis
Types ¶
type RedisBackend ¶
type RedisBackend struct {
// contains filtered or unexported fields
}
func NewRedisBackend ¶
func NewRedisBackend(cfg RedisConfig) (*RedisBackend, error)
func (*RedisBackend) Close ¶
func (r *RedisBackend) Close() error
Calls all necessary finalization if necessary
func (*RedisBackend) GetLocks ¶
func (r *RedisBackend) GetLocks(group string) (int, error)
Returns the current number of locks for the given group
func (*RedisBackend) GetStaleLocks ¶
Return all locks older than x
func (*RedisBackend) HasLock ¶
func (r *RedisBackend) HasLock(group string, id string) (bool, error)
Check if a given id already has a lock for this group
type RedisConfig ¶
type RedisConfig struct { Addr string `yaml:"address,omitempty"` Addrs []string `yaml:"addresses,omitempty"` Username string `yaml:"username,omitempty"` Password string `yaml:"password,omitempty"` DB int `yaml:"db,omitempty"` TLS bool `yaml:"tls,omitempty"` Sentinel RedisSentinelConfig `yaml:"sentinel,omitempty"` }
Click to show internal directories.
Click to hide internal directories.