Redis

package
v0.0.0-...-fa69253 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2019 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultExpirationTime int64  = 0           // records won't expire
	RecordPrefix          string = "user_data" // prefix for redis records
	InitialState          string = "~"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type RedisStorage

type RedisStorage struct {
	*redis.Client
}

func (*RedisStorage) Flush

func (csm *RedisStorage) Flush()

remove all stored data and database (flush db)

func (*RedisStorage) Get

func (csm *RedisStorage) Get(sessionID int64) (string, map[string]interface{})

func (*RedisStorage) GetData

func (csm *RedisStorage) GetData(sessionID int64) map[string]interface{}

get user's saved data if no user found - will create new bucket

func (*RedisStorage) Reset

func (csm *RedisStorage) Reset(sessionID int64)

update data bucket

func (*RedisStorage) Set

func (csm *RedisStorage) Set(sessionID int64, state string)

TODO: discuss if __state__ key must be array of database and renamed to __states__

func (*RedisStorage) SetData

func (csm *RedisStorage) SetData(sessionID int64, data map[string]interface{})

update data bucket

func (*RedisStorage) UpdateState

func (csm *RedisStorage) UpdateState(sessionID int64, state string) map[string]interface{}

sets new state TODO: discuss if __state__ key must be array of database and renamed to __states__

Jump to

Keyboard shortcuts

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