redismodule

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HashCmd added in v0.0.4

func HashCmd() *cmdHash

func KeyCmd added in v0.0.4

func KeyCmd() *cmdKey

func LockWithDeadline

func LockWithDeadline(ctx context.Context, key string, lockTtl time.Duration, retryDeadline time.Time, retryInterval int, executable func()) error

LockWithDeadline 持续尝试获取锁 request lockTtl 获得锁之后的持续时长(超时自动释放)

retryDeadline 重试持续时间
retryInterval 重试间隔(millisecond)

func LockWithMaxRetry

func LockWithMaxRetry(ctx context.Context, key string, lockTtl time.Duration, retryMax, retryInterval int, executable func()) error

LockWithMaxRetry 持续尝试获取锁 request lockTtl 获得锁之后的持续时长(超时自动释放)

retryMax 尝试获取锁最大重试次数
intervalMil 重试间隔(millisecond)

func OriginKeyString added in v0.0.4

func OriginKeyString(keyFormat string, keyAppend ...interface{}) string

func QueueCmd added in v0.0.6

func QueueCmd() *cmdQueue

func RawInstance added in v0.0.5

func RawInstance() redis.UniversalClient

RawInstance 获取原始RedisClient进行操作

func SetCmd added in v0.0.5

func SetCmd() *cmdSet

func StringCmd added in v0.0.4

func StringCmd() *cmdString

func TopicCmd added in v0.0.6

func TopicCmd() *cmdTopic

func TryLock

func TryLock(key string, lockTtl time.Duration, executable func()) error

TryLock 取锁并执行executable函数 request lockTtl: 获得锁之后的持续时长(超时自动释放)

func TryLockWithContext

func TryLockWithContext(ctx context.Context, key string, lockTtl time.Duration, executable func()) error

TryLockWithContext 取锁并执行executable函数

Types

type RedisKey

type RedisKey struct {

	// 最终key值的格式化格式 将使用 fmt.Sprintf(key.KeyFormat, keyAppend) 进行处理
	KeyFormat string
	Expire    time.Duration
}

type RedisModule

type RedisModule struct {
	RedisConfig     redis.UniversalOptions
	LazyRedisConfig func() redis.UniversalOptions

	RedisModuleConfig *declaration.ModuleConfig
	RedisInterceptor  func(instance redis.UniversalClient)
}

func (*RedisModule) ModuleConfig

func (r *RedisModule) ModuleConfig() *declaration.ModuleConfig

func (*RedisModule) Register

func (r *RedisModule) Register() (interface{}, error)

func (*RedisModule) Unregister

func (r *RedisModule) Unregister(maxWaitSeconds uint) (gracefully bool, err error)

Jump to

Keyboard shortcuts

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