valkey

package
v1.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 2, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewValkeyLoadbalancer

func NewValkeyLoadbalancer(opt valkey.ClientOption) (valkey.Client, *loadbalancer, error)

Create a new valkey client with loadbalanced connections

Types

type ValkeyBackend

type ValkeyBackend struct {
	// contains filtered or unexported fields
}

func NewValkeyBackend

func NewValkeyBackend(cfg ValkeyConfig) (*ValkeyBackend, error)

func (*ValkeyBackend) Close

func (r *ValkeyBackend) Close() error

Calls all necessary finalization if necessary

func (*ValkeyBackend) GetLocks

func (r *ValkeyBackend) GetLocks(group string) (int, error)

Returns the current number of locks for the given group

func (*ValkeyBackend) GetStaleLocks

func (r *ValkeyBackend) GetStaleLocks(ts time.Duration) ([]types.Lock, error)

Return all locks older than x

func (*ValkeyBackend) HasLock

func (r *ValkeyBackend) HasLock(group string, id string) (bool, error)

Check if a given id already has a lock for this group

func (*ValkeyBackend) Release

func (r *ValkeyBackend) Release(group string, id string) error

Release the lock currently held by the id. Does not fail when no lock is held.

func (*ValkeyBackend) Reserve

func (r *ValkeyBackend) Reserve(group string, id string) error

Reserve a lock for the given group. Returns true if the lock is successfully reserved, even if the lock is already held by the specific id

type ValkeyConfig

type ValkeyConfig struct {
	Addrs    []string             `yaml:"addresses,omitempty"`
	Username string               `yaml:"username,omitempty"`
	Password string               `yaml:"password,omitempty"`
	DB       int                  `yaml:"db,omitempty"`
	TLS      bool                 `yaml:"tls,omitempty"`
	Sentinel ValkeySentinelConfig `yaml:"sentinel,omitempty"`
}

type ValkeySentinelConfig

type ValkeySentinelConfig struct {
	Enabled    bool     `yaml:"enabled,omitempty"`
	MasterName string   `yaml:"master,omitempty"`
	Addresses  []string `yaml:"addresses,omitempty"`
	Username   string   `yaml:"username,omitempty"`
	Password   string   `yaml:"password,omitempty"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL