redis

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2023 License: AGPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Address     string        `koanf:"address"`
	Password    string        `koanf:"password"`
	DB          int           `koanf:"db"`
	ActiveConns int           `koanf:"active_conns"`
	IdleConns   int           `koanf:"idle_conns"`
	Timeout     time.Duration `koanf:"timeout"`

	PrefixRoom    string `koanf:"prefix_room"`
	PrefixSession string `koanf:"prefix_session"`
}

Config represents the Redis store config structure.

type Redis

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

Redis represents the Redis implementation of the Store interface.

func New

func New(cfg Config) (*Redis, error)

New returns a new Redis store.

func (*Redis) AddRoom

func (r *Redis) AddRoom(room store.Room, ttl time.Duration) error

AddRoom adds a room to the store.

func (*Redis) AddSession

func (r *Redis) AddSession(sessID, handle, roomID string, ttl time.Duration) error

AddSession adds a sessionID room to the store.

func (*Redis) ClearSessions

func (r *Redis) ClearSessions(roomID string) error

ClearSessions deletes all the sessions in a room.

func (*Redis) ExtendRoomTTL

func (r *Redis) ExtendRoomTTL(id string, ttl time.Duration) error

ExtendRoomTTL extends a room's TTL.

func (*Redis) Get added in v0.1.1

func (r *Redis) Get(key string) ([]byte, error)

Get value from a key.

func (*Redis) GetRoom

func (r *Redis) GetRoom(id string) (store.Room, error)

GetRoom gets a room from the store.

func (*Redis) GetSession

func (r *Redis) GetSession(sessID, roomID string) (store.Sess, error)

GetSession retrieves a peer session from th store.

func (*Redis) RemoveRoom

func (r *Redis) RemoveRoom(id string) error

RemoveRoom deletes a room from the store.

func (*Redis) RemoveSession

func (r *Redis) RemoveSession(sessID, roomID string) error

RemoveSession deletes a session ID from a room.

func (*Redis) RoomExists

func (r *Redis) RoomExists(id string) (bool, error)

RoomExists checks if a room exists in the store.

func (*Redis) Set added in v0.1.1

func (r *Redis) Set(key string, data []byte) error

Set a value.

Jump to

Keyboard shortcuts

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