Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrFailedToConnectToRedis = errors.New("failed to connect to Redis") ErrFailedToPingRedis = errors.New("failed to ping Redis") ErrTLSRequestedButNotEnabled = errors.New("TLS requested but not enabled") ErrFailedToAppendCACert = errors.New("failed to append CA cert") ErrEmptyCacheID = errors.New("cache ID cannot be empty") ErrInvalidExpiresAfter = errors.New("invalid expires after") ErrInvalidBatchSize = errors.New("invalid batch size") )
Functions ¶
func NewRedisClient ¶
func NewRedisClient(ctx context.Context, retryOpts helper.RetryOptions, opts RedisClientOptions) (contract.RedisClient, error)
Types ¶
type Blackbox ¶
type Blackbox interface {
StatusCmdErr(cmd *redis.StatusCmd) error
ScanIteratorErr(iter *redis.ScanIterator) error
PipelineDelErr(pipe redis.Pipeliner, ctx context.Context, key string) error
PipelineExec(pipe redis.Pipeliner, ctx context.Context) error
StringCmdResult(cmd *redis.StringCmd) (string, error)
BoolCmdErr(cmd *redis.BoolCmd) (bool, error)
IntCmdErr(cmd *redis.IntCmd) (int64, error)
}
type Client ¶
type Client interface {
contract.CacheOperator
}
func NewClient ¶
func NewClient(c contract.RedisClient, m contract.Marshaler, u contract.Unmarshaler, opts ClientOptions) (Client, error)
type ClientOption ¶
type ClientOption func(*ClientOptions)
func WithBatchSize ¶
func WithBatchSize(size int) ClientOption
func WithExpiresAfter ¶
func WithExpiresAfter(d time.Duration) ClientOption
type ClientOptions ¶
func ApplyClientOptions ¶
func ApplyClientOptions(opts *ClientOptions, modifiers ...ClientOption) ClientOptions
type RedisClientOptions ¶
type RedisClientOptions struct {
C contract.CertGenerator
F contract.FSysFileReader
FS fs.ReadFileFS
Port int
Host string
Username string
Password string
CertPath string
KeyPath string
CAPath string
UseTLS bool
MutualTLS bool
}
Click to show internal directories.
Click to hide internal directories.