Documentation ¶
Index ¶
Constants ¶
const ( // RedisDefaultSetValue will be used if the "Set" check method is enabled // and "RedisSetOptions.Value" is _not_ set. RedisDefaultSetValue = "go-health/redis-check" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Redis ¶
type Redis struct { Config *RedisConfig // contains filtered or unexported fields }
Redis implements the ICheckable interface
func NewRedis ¶
func NewRedis(cfg *RedisConfig) (*Redis, error)
NewRedis creates a new "go-redis/redis" checker that can be used w/ "AddChecks()".
type RedisAuthConfig ¶
type RedisAuthConfig struct { Addr string // `host:port` format Password string // leave blank if no password DB int // leave unset if no specific db TLS *tls.Config // TLS config in case we are using in-transit encryption }
RedisAuthConfig defines how to connect to redis.
type RedisConfig ¶
type RedisConfig struct { Auth *RedisAuthConfig Ping bool Set *RedisSetOptions Get *RedisGetOptions }
RedisConfig is used for configuring the go-redis check.
"Auth" is _required_; redis connection/auth config.
"Ping" is optional; the most basic check method, performs a `.Ping()` on the client.
"Get" is optional; perform a "GET" on a key; refer to the "RedisGetOptions" docs for details.
"Set" is optional; perform a "SET" on a key; refer to the "RedisSetOptions" docs for details.
Note: At least _one_ check method must be set/enabled; you can also enable _all_ of the check methods (ie. perform a ping, set this key and now try to retrieve that key).
type RedisGetOptions ¶
RedisGetOptions contains attributes that can alter the behavior of the redis "GET" check.
"Key" is _required_; the name of the key that we are attempting to "GET".
"Expect" is optional; optionally verify that the value for the key matches the Expect value.
"NoErrorMissingKey" is optional; by default, the "GET" check will error if the key we are fetching does not exist; flip this bool if that is normal/expected/ok.
type RedisSetOptions ¶
RedisSetOptions contains attributes that can alter the behavior of the redis "SET" check.
"Key" is _required_; the name of the key we are attempting to "SET".
"Value" is optional; what the value should hold; if not set, it will be set to "RedisDefaultSetValue".
"Expiration" is optional; if set, a TTL will be attached to the key.