Documentation ¶
Overview ¶
Package redis implements a Redis backed session manager for RiveScript.
Index ¶
- type Config
- type Session
- func (s *Session) AddHistory(username, input, reply string)
- func (s *Session) Clear(username string)
- func (s *Session) ClearAll()
- func (s *Session) Freeze(username string) error
- func (s *Session) Get(username, name string) (string, error)
- func (s *Session) GetAll() map[string]*sessions.UserData
- func (s *Session) GetAny(username string) (*sessions.UserData, error)
- func (s *Session) GetHistory(username string) (*sessions.History, error)
- func (s *Session) GetLastMatch(username string) (string, error)
- func (s *Session) Init(username string) *sessions.UserData
- func (s *Session) Set(username string, vars map[string]string)
- func (s *Session) SetLastMatch(username, trigger string)
- func (s *Session) Thaw(username string, action sessions.ThawAction) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { // The key prefix to use in Redis. For example, with a username of 'alice', // the Redis key might be 'rivescript/alice'. // // The default prefix is 'rivescript/' Prefix string // The key used to prefix frozen user variables (those created by // `Freeze()`). The default is `frozen:<prefix>` FrozenPrefix string // Settings for the Redis client. Redis *redis.Options }
Config allows for configuring the Redis instance and key prefix.
type Session ¶
type Session struct {
// contains filtered or unexported fields
}
Session wraps a Redis client connection.
func (*Session) AddHistory ¶
AddHistory adds to a user's history data.
func (*Session) ClearAll ¶
func (s *Session) ClearAll()
ClearAll resets all user data for all users.
func (*Session) GetHistory ¶
GetHistory gets the user's history.
func (*Session) GetLastMatch ¶
GetLastMatch retrieves the user's last matched trigger.
func (*Session) Init ¶
Init makes sure that a username has a session (creates one if not), and returns the pointer to it in any event.
func (*Session) SetLastMatch ¶
SetLastMatch sets the user's last matched trigger.
Click to show internal directories.
Click to hide internal directories.