Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func New ¶
func New(clientOpts *redis.Options, lockOpts *redislock.Options, defaultLockTTL time.Duration) circuitry.StorageBackender
New builds a new StorageBackender for circuitry.
func WithRedisBackend ¶
func WithRedisBackend(clientOpts *redis.Options, lockOpts *redislock.Options, defaultLockTTL time.Duration) circuitry.SettingsOption
WithRedisBackend provides a way to configure the StorageBackend for a Circuit Breaker Factory's esttings.
Types ¶
type Backend ¶
type Backend struct {
Client Client
Locker Locker
LockOpts *redislock.Options
DefaultLockTTL time.Duration
}
Backend implements the StorageBackender interface for Redis using redis/go-redis/v9 and bsm/redislock
func (*Backend) Lock ¶
Lock builds a lock in Redis with the DefaultTTL and returns an interface that matches sync.Locker
type Client ¶
type Client interface {
Get(context.Context, string) *redis.StringCmd
Set(context.Context, string, any, time.Duration) *redis.StatusCmd
SetArgs(context.Context, string, any, redis.SetArgs) *redis.StatusCmd
redis.Scripter // Need this interface for redislock
}
Client describes the interface expected for this backend to function appropriately
Click to show internal directories.
Click to hide internal directories.