redis

package module
v2.0.0-...-44dd1c6 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2024 License: MIT Imports: 12 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Locator

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

func NewLocator

func NewLocator(opts ...Option) *Locator

func (*Locator) BindGate

func (l *Locator) BindGate(ctx context.Context, uid int64, gid string) error

BindGate 绑定网关

func (*Locator) BindNode

func (l *Locator) BindNode(ctx context.Context, uid int64, name, nid string) error

BindNode 绑定节点

func (*Locator) LocateGate

func (l *Locator) LocateGate(ctx context.Context, uid int64) (string, error)

LocateGate 定位用户所在网关

func (*Locator) LocateNode

func (l *Locator) LocateNode(ctx context.Context, uid int64, name string) (string, error)

LocateNode 定位用户所在节点

func (*Locator) Name

func (l *Locator) Name() string

Name 获取定位器组件名

func (*Locator) UnbindGate

func (l *Locator) UnbindGate(ctx context.Context, uid int64, gid string) error

UnbindGate 解绑网关

func (*Locator) UnbindNode

func (l *Locator) UnbindNode(ctx context.Context, uid int64, name string, nid string) error

UnbindNode 解绑节点

func (*Locator) Watch

func (l *Locator) Watch(ctx context.Context, kinds ...string) (locate.Watcher, error)

Watch 监听用户定位变化

type Option

type Option func(o *options)

func WithAddrs

func WithAddrs(addrs ...string) Option

WithAddrs 设置连接地址

func WithClient

func WithClient(client redis.UniversalClient) Option

WithClient 设置外部客户端

func WithContext

func WithContext(ctx context.Context) Option

WithContext 设置上下文

func WithDB

func WithDB(db int) Option

WithDB 设置数据库号

func WithMaxRetries

func WithMaxRetries(maxRetries int) Option

WithMaxRetries 设置最大重试次数

func WithPassword

func WithPassword(password string) Option

WithPassword 设置密码

func WithPrefix

func WithPrefix(prefix string) Option

WithPrefix 设置前缀

func WithUsername

func WithUsername(username string) Option

WithUsername 设置用户名

Jump to

Keyboard shortcuts

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