Documentation
¶
Index ¶
- type Config
- type FailoverConfig
- type Provider
- func (p *Provider) Count() int
- func (p *Provider) Destroy(id []byte) error
- func (p *Provider) GC() error
- func (p *Provider) Get(id []byte) ([]byte, error)
- func (p *Provider) NeedGC() bool
- func (p *Provider) Regenerate(id, newID []byte, expiration time.Duration) error
- func (p *Provider) Save(id, data []byte, expiration time.Duration) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { // Key prefix KeyPrefix string // The network type, either tcp or unix. // Default is tcp. Network string // host:port address. Addr string // Optional username. Username string // Optional password. Must match the password specified in the // requirepass server configuration option. Password string // Database to be selected after connecting to the server. DB int // Maximum number of retries before giving up. // Default is to not retry failed commands. MaxRetries int // Minimum backoff between each retry. // Default is 8 milliseconds; -1 disables backoff. MinRetryBackoff time.Duration // Maximum backoff between each retry. // Default is 512 milliseconds; -1 disables backoff. MaxRetryBackoff time.Duration // Dial timeout for establishing new connections. // Default is 5 seconds. DialTimeout time.Duration // Timeout for socket reads. If reached, commands will fail // with a timeout instead of blocking. Use value -1 for no timeout and 0 for default. // Default is 3 seconds. ReadTimeout time.Duration // Timeout for socket writes. If reached, commands will fail // with a timeout instead of blocking. // Default is ReadTimeout. WriteTimeout time.Duration // Maximum number of socket connections. // Default is 10 connections per every CPU as reported by runtime.NumCPU. PoolSize int // Minimum number of idle connections which is useful when establishing // new connection is slow. MinIdleConns int // Connection age at which client retires (closes) the connection. // Default is to not close aged connections. MaxConnAge time.Duration // Amount of time client waits for connection if all connections // are busy before returning an error. // Default is ReadTimeout + 1 second. PoolTimeout time.Duration // Amount of time after which client closes idle connections. // Should be less than server's timeout. // Default is 5 minutes. -1 disables idle timeout check. IdleTimeout time.Duration // Frequency of idle checks made by idle connections reaper. // Default is 1 minute. -1 disables idle connections reaper, // but idle connections are still discarded by the client // if IdleTimeout is set. IdleCheckFrequency time.Duration // TLS Config to use. When set TLS will be negotiated. TLSConfig *tls.Config // Limiter interface used to implemented circuit breaker or rate limiter. Limiter redis.Limiter }
Config provider settings
type FailoverConfig ¶ added in v2.5.5
type FailoverConfig struct { // Key prefix KeyPrefix string // Optional username. Username string // Optional password. Must match the password specified in the // requirepass server configuration option. Password string // Database to be selected after connecting to the server. DB int // The sentinel master name. MasterName string // The sentinel nodes seed list (host:port). SentinelAddrs []string // The password for the sentinel connection if required (different to username/password). SentinelPassword string // Routes read-only commands to the closest node. RouteByLatency bool // Routes read-only commands in random order. RouteRandomly bool // Route read-only commands to slave nodes. SlaveOnly bool // Maximum number of retries before giving up. // Default is to not retry failed commands. MaxRetries int // Minimum backoff between each retry. // Default is 8 milliseconds; -1 disables backoff. MinRetryBackoff time.Duration // Maximum backoff between each retry. // Default is 512 milliseconds; -1 disables backoff. MaxRetryBackoff time.Duration // Dial timeout for establishing new connections. // Default is 5 seconds. DialTimeout time.Duration // Timeout for socket reads. If reached, commands will fail // with a timeout instead of blocking. Use value -1 for no timeout and 0 for default. // Default is 3 seconds. ReadTimeout time.Duration // Timeout for socket writes. If reached, commands will fail // with a timeout instead of blocking. // Default is ReadTimeout. WriteTimeout time.Duration // Maximum number of socket connections. // Default is 10 connections per every CPU as reported by runtime.NumCPU. PoolSize int // Minimum number of idle connections which is useful when establishing // new connection is slow. MinIdleConns int // Connection age at which client retires (closes) the connection. // Default is to not close aged connections. MaxConnAge time.Duration // Amount of time client waits for connection if all connections // are busy before returning an error. // Default is ReadTimeout + 1 second. PoolTimeout time.Duration // Amount of time after which client closes idle connections. // Should be less than server's timeout. // Default is 5 minutes. -1 disables idle timeout check. IdleTimeout time.Duration // Frequency of idle checks made by idle connections reaper. // Default is 1 minute. -1 disables idle connections reaper, // but idle connections are still discarded by the client // if IdleTimeout is set. IdleCheckFrequency time.Duration // TLS Config to use. When set TLS will be negotiated. TLSConfig *tls.Config }
FailoverConfig provider settings
type Provider ¶
type Provider struct {
// contains filtered or unexported fields
}
Provider backend manager
func NewFailover ¶ added in v2.5.5
func NewFailover(cfg FailoverConfig) (*Provider, error)
NewFailover returns a new configured redis failover (sentinel) provider
func NewFailoverCluster ¶ added in v2.5.7
func NewFailoverCluster(cfg FailoverConfig) (*Provider, error)
func (*Provider) Regenerate ¶
Regenerate updates the session id and expiration with the new session id of the the given current session id
Click to show internal directories.
Click to hide internal directories.