Documentation ¶
Index ¶
- Constants
- func InitFailoverRedis(masterName string, sentinelAddrs []string, password string, ...) (*redis.Client, error)
- func InitRedis(addr string, pass string) (*redis.Client, error)
- func KeyLocation(account, device string) string
- func KeyLocations(accounts ...string) []string
- func KeySession(channel string) string
- type RedisStorage
- func (r *RedisStorage) Add(session *pkt.Session) error
- func (r *RedisStorage) Delete(account string, channelId string) error
- func (r *RedisStorage) Get(channelId string) (*pkt.Session, error)
- func (r *RedisStorage) GetLocation(account string, device string) (*him.Location, error)
- func (r *RedisStorage) GetLocations(account ...string) ([]*him.Location, error)
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 KeyLocation ¶
func KeyLocations ¶
func KeySession ¶
Types ¶
type RedisStorage ¶
type RedisStorage struct {
// contains filtered or unexported fields
}
func NewRedisStorage ¶
func NewRedisStorage(cli *redis.Client) *RedisStorage
func (*RedisStorage) Get ¶
func (r *RedisStorage) Get(channelId string) (*pkt.Session, error)
Get GetByID to get session by sessionID
func (*RedisStorage) GetLocation ¶
func (*RedisStorage) GetLocations ¶
func (r *RedisStorage) GetLocations(account ...string) ([]*him.Location, error)
GetLocations 批量读取位置信息
Click to show internal directories.
Click to hide internal directories.