Documentation
¶
Index ¶
- Constants
- Variables
- type ListOption
- type Lock
- type Option
- func WithAddress(address string) Option
- func WithClientName(clientName string) Option
- func WithConnTimeout(connTimeout time.Duration) Option
- func WithDB(db int) Option
- func WithIdleTimeout(idleTimeout time.Duration) Option
- func WithMaxActive(maxActive int) Option
- func WithMaxConnLifetime(maxConnLifetime time.Duration) Option
- func WithMaxIdle(maxIdle int) Option
- func WithPassword(password string) Option
- func WithSkipVerify(skipVerify bool) Option
- func WithTLSConfig(tlsConfig *tls.Config) Option
- func WithUseTLS(useTLS bool) Option
- func WithWait(wait bool) Option
- type Redigo
- func (r *Redigo) BlockLock(key string, expiry time.Duration) (func() error, error)
- func (r *Redigo) Decr(key string, v ...int64) (reply any, err error)
- func (r *Redigo) Del(key string) (int64, error)
- func (r *Redigo) Do(cmd string, args ...any) (any, error)
- func (r *Redigo) Exists(key string) (bool, error)
- func (r *Redigo) Expire(key string, expiration time.Duration) error
- func (r *Redigo) Get(key string, v any) error
- func (r *Redigo) Incr(key string, v any) (reply any, err error)
- func (r *Redigo) ListLen(key string) (n int64, err error)
- func (r *Redigo) ListPop(key string, n int, v any, opts ...ListOption) (err error)
- func (r *Redigo) ListPush(key string, v any, opts ...ListOption) (ret int64, err error)
- func (r *Redigo) ListRange(key string, start, stop int64, v any) (err error)
- func (r *Redigo) Set(key string, v any, opts ...SetOption) error
- func (r *Redigo) TTL(key string) (int64, error)
- func (r *Redigo) TryLock(key string, expiry time.Duration, timeout time.Duration) (func() error, error)
- type SetOption
Constants ¶
View Source
const (
RedisOK = "OK"
)
Variables ¶
View Source
var ( ErrKeyExists = errors.New("key already exists") ErrKeyNotExists = errors.New("key does not exist") ErrInvalidResponse = errors.New("invalid response from server") ErrLockAcquisitionFailed = errors.New("failed to acquire lock") ErrLockNotHeld = errors.New("lock not held by this instance") )
Functions ¶
This section is empty.
Types ¶
type ListOption ¶
type ListOption func(*listOptions)
func WithBlock ¶
func WithBlock() ListOption
func WithRright ¶
func WithRright() ListOption
func WithUnwind ¶
func WithUnwind() ListOption
type Lock ¶
type Lock struct {
// contains filtered or unexported fields
}
Lock represents a distributed lock
type Option ¶
type Option func(*redigoOptions)
func WithAddress ¶
func WithClientName ¶
func WithConnTimeout ¶
func WithIdleTimeout ¶
func WithMaxActive ¶
func WithMaxConnLifetime ¶
func WithMaxIdle ¶
func WithPassword ¶
func WithSkipVerify ¶
func WithTLSConfig ¶
func WithUseTLS ¶
type Redigo ¶
type Redigo struct {
// contains filtered or unexported fields
}
func (*Redigo) BlockLock ¶
BlockLock acquires a distributed lock in blocking mode It returns an unlock function and an error if failed to acquire lock
func (*Redigo) Incr ¶
Incr increment the value of a key by 1 if v is nil, otherwise v must be an integer or float number
Click to show internal directories.
Click to hide internal directories.