Documentation ¶
Overview ¶
Package remote 基于 redis list 实现的分布式 session manager。
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrGotLockFailed 抢锁失败 ErrGotLockFailed = errors.New("compete for init sessions failed, wait to consume session") // ErrSessionMarshalFailed 从redis中读取session后解析失败 ErrSessionMarshalFailed = errors.New("session marshal failed") // ErrProduceFailed 生产session失败 ErrProduceFailed = errors.New("produce session failed") // ErrorNotOk redis 写失败 ErrorNotOk = errors.New("redis write not ok") )
Functions ¶
This section is empty.
Types ¶
type Option ¶
type Option func(manager *RedisManager)
Option is a function that configures a Remote.
func WithClusterKey ¶
WithClusterKey 自定义集群key,用于创建分布式锁与redis list
type RedisManager ¶
type RedisManager struct {
// contains filtered or unexported fields
}
RedisManager 基于 redis 的 session 管理器,实现分布式 websocket 监听
func New ¶
func New(client *redis.Client, opts ...Option) *RedisManager
New 创建一个新的基于 redis 的 session 管理器 使用 go-redis 调用 redis,超时时间请在 NewClient 时候设置
func (*RedisManager) Start ¶
func (r *RedisManager) Start(apInfo *dto.WebsocketAP, tokenSource oauth2.TokenSource, intents *dto.Intent) error
Start 启动 redis 的 session 管理器
Click to show internal directories.
Click to hide internal directories.