redisx

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2025 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var MaxRetry = maxRetry

Functions

This section is empty.

Types

type BoundedQueue

type BoundedQueue interface {
	Queue
	Cap() uint64
}

func NewBoundedQueue

func NewBoundedQueue(rc Client, key string, cap uint64) BoundedQueue

func NewBoundedUniqueQueue

func NewBoundedUniqueQueue(rc Client, key string, cap uint64) BoundedQueue

type Client

type Client interface {
	redis.UniversalClient
}

type Lock

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

A Lock is a redis lock.

func NewLock

func NewLock(store redis.Cmdable, key string, expireSec uint32) *Lock

NewLock returns a Lock.

func (*Lock) Acquire

func (rl *Lock) Acquire() (bool, error)

Acquire acquires the lock.

func (*Lock) AcquireCtx

func (rl *Lock) AcquireCtx(ctx context.Context) (bool, error)

AcquireCtx acquires the lock with the given ctx.

func (*Lock) AcquireWait

func (rl *Lock) AcquireWait() error

func (*Lock) AcquireWaitCtx

func (rl *Lock) AcquireWaitCtx(ctx context.Context) error

func (*Lock) Release

func (rl *Lock) Release() (bool, error)

Release releases the lock.

func (*Lock) ReleaseCtx

func (rl *Lock) ReleaseCtx(ctx context.Context) (bool, error)

ReleaseCtx releases the lock with the given ctx.

func (*Lock) SetExpire

func (rl *Lock) SetExpire(seconds int)

SetExpire sets the expiration.

type Queue

type Queue interface {
	Push(v ...any) error
	Pop() (string, error)
	PopN(n int) ([]string, error)
	BPop() (string, error)
	Len() uint64
}

func NewQueue

func NewQueue(rc Client, key string) Queue

func NewUniqueQueue

func NewUniqueQueue(rc Client, key string) Queue

type Redis

type Redis interface {
	Keys(partern string) ([]string, error)
}

type Set

type Set interface {
	Redis
	Add(vs ...any) error
	Rem(vs ...any) error
	IsMember(v any) bool
	IsMembers(vs ...any) []bool
	Len() int64
}

func NewSet

func NewSet(rc Client, key string) Set

type UniqueQueue

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

func NewExportUniqueQueue

func NewExportUniqueQueue(rc Client, key string) UniqueQueue

func (UniqueQueue) BPop

func (uq UniqueQueue) BPop() (string, error)

func (UniqueQueue) Pop

func (uq UniqueQueue) Pop() (string, error)

func (UniqueQueue) PopN

func (uq UniqueQueue) PopN(n int) ([]string, error)

func (UniqueQueue) Push

func (uq UniqueQueue) Push(vs ...any) error

Jump to

Keyboard shortcuts

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