Documentation
¶
Index ¶
- Variables
- type Client
- func (c *Client) Close() error
- func (c *Client) Get(ctx context.Context, key string) *redis.StringCmd
- func (c *Client) HealthStatus(ctx context.Context) string
- func (c *Client) IsConnected(ctx context.Context) bool
- func (c *Client) SetEX(ctx context.Context, key string, value interface{}, expiration time.Duration) *redis.StatusCmd
- type RedisCmdable
Constants ¶
This section is empty.
Variables ¶
View Source
var NewRedisClient = func(opt *redis.Options) *redis.Client { return redis.NewClient(opt) }
NewRedisClient is a variable wrapper around redis.NewClient so tests can override it.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
Redis RedisCmdable
}
Client holds the Redis client instance (now interface for testability)
func (*Client) Get ¶ added in v1.1.3
Get wraps the underlying Redis GET command and returns a *redis.StringCmd.
func (*Client) HealthStatus ¶ added in v1.1.1
HealthStatus returns a string describing the current health of the Redis connection.
func (*Client) IsConnected ¶ added in v1.1.1
IsConnected checks if the Redis client is connected and responsive.
type RedisCmdable ¶ added in v1.1.3
type RedisCmdable interface {
Ping(ctx context.Context) *redis.StatusCmd
Get(ctx context.Context, key string) *redis.StringCmd
SetEX(ctx context.Context, key string, value interface{}, expiration time.Duration) *redis.StatusCmd
Close() error
}
RedisCmdable defines the subset of redis client methods we need. Keep it minimal so tests can provide simple mocks.
Click to show internal directories.
Click to hide internal directories.