redis

package
v0.0.0-...-d450093 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Redis

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

Redis holds the connection to redis.

func New

func New(readAddr, writeAddr, sessionPrefix string) *Redis

New create a new Redis instance.

func (*Redis) AddApplause

func (r *Redis) AddApplause(userID int) error

AddApplause adds a user to the applause set.

Also deletes applause that is older then a minute

func (*Redis) ChangedKeys

func (r *Redis) ChangedKeys(from, to int) ([]string, error)

ChangedKeys returns all keys in the changeidkey higher from and lower or equal to.

func (*Redis) Data

func (r *Redis) Data(keys []string) (map[string]json.RawMessage, error)

Data returns the data from redis for specific keys from the full data hash key.

If a key does not exist, the value in the returned dict is nil.

func (*Redis) FullData

func (r *Redis) FullData() (data map[string]json.RawMessage, max int, min int, err error)

FullData gets all data from redis. It also gets the min and max change id in a atomic way.

func (*Redis) GetApplause

func (r *Redis) GetApplause(since int64) (int, error)

GetApplause returns the amount of applause sind a time.

func (*Redis) GetSession

func (r *Redis) GetSession(sessionID string) ([]byte, error)

GetSession returns the session data for a sessionID.

func (*Redis) ReceiveNotify

func (r *Redis) ReceiveNotify(closing <-chan struct{}) (message string, err error)

ReceiveNotify returns the next notify message.

func (*Redis) SendNotify

func (r *Redis) SendNotify(message []byte) error

SendNotify publishes a notify message in redis.

func (*Redis) TestReadConn

func (r *Redis) TestReadConn() error

TestReadConn sends a ping command to redis. Does not return the response, but an error if there is no response.

func (*Redis) TestWriteConn

func (r *Redis) TestWriteConn() error

TestWriteConn sends a ping command to redis. Does not return the response, but an error if there is no response.

func (*Redis) Update

func (r *Redis) Update(closing <-chan struct{}) ([]byte, error)

Update returns changed keys.

Blocks until there is new data.

Jump to

Keyboard shortcuts

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