xredis

package module
v0.0.0-...-83a803a Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2024 License: MIT Imports: 7 Imported by: 0

README

How to Use

  • NewPreempt: Using redis to preempt locks and ensure uniqueness of execution tasks.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Subscribes = make([]*Subscribe, 0)

Functions

func Close

func Close() error

Close 消息订阅关闭

Types

type Preempt

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

func NewPreempt

func NewPreempt(ctx context.Context, db *eredis.Component, key string, startFunc, closeFunc func()) *Preempt

func (*Preempt) Close

func (p *Preempt) Close()

type Subscribe

type Subscribe struct {
	DbRedis *redis.Client
	// contains filtered or unexported fields
}

func Init

func Init(ctx context.Context, client *redis.Client, channels map[string]func(ctx context.Context, pubSub *redis.PubSub)) *Subscribe

Init 全局 Subscribe 初始化

func (*Subscribe) Pub

func (s *Subscribe) Pub(ctx context.Context, channel string, message []byte) error

Pub 发布

func (*Subscribe) Sub

func (s *Subscribe) Sub(ctx context.Context, channel string) *redis.PubSub

Sub 订阅

Jump to

Keyboard shortcuts

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