storage

package
v0.0.0-...-93c743e Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const LocationExpired = time.Hour * 2

Variables

This section is empty.

Functions

func InitFailoverRedis

func InitFailoverRedis(masterName string, sentinelAddrs []string, password string, timeout time.Duration) (*redis.Client, error)

InitFailoverRedis init redis with sentinels

func InitRedis

func InitRedis(addr string, pass string) (*redis.Client, error)

InitRedis return a redis instance

func KeyLocation

func KeyLocation(account, device string) string

func KeyLocations

func KeyLocations(accounts ...string) []string

func KeySession

func KeySession(channel string) string

Types

type RedisStorage

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

func NewRedisStorage

func NewRedisStorage(cli *redis.Client) *RedisStorage

func (*RedisStorage) Add

func (r *RedisStorage) Add(session *pkt.Session) error

Add 添加会话

func (*RedisStorage) Delete

func (r *RedisStorage) Delete(account string, channelId string) error

func (*RedisStorage) Get

func (r *RedisStorage) Get(channelId string) (*pkt.Session, error)

Get GetByID to get session by sessionID

func (*RedisStorage) GetLocation

func (r *RedisStorage) GetLocation(account string, device string) (*him.Location, error)

func (*RedisStorage) GetLocations

func (r *RedisStorage) GetLocations(account ...string) ([]*him.Location, error)

GetLocations 批量读取位置信息

Jump to

Keyboard shortcuts

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