Documentation
¶
Index ¶
- func Initialize(config Config) error
- type Config
- type Session
- type SessionManager
- func (sm *SessionManager) CreateSession(sessionId string, userId string, duration time.Duration) (*Session, error)
- func (sm *SessionManager) DeleteSession(sessionId string) error
- func (sm *SessionManager) ExtendSession(sessionId string, duration time.Duration) error
- func (sm *SessionManager) GetSession(sessionId string) (*Session, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Initialize ¶
Initialize a new Redis client with the given configuration and return any errors we may encounter along the way
Types ¶
type Session ¶
type Session struct { UserId string `json:"userId"` CreatedAt time.Time `json:"createdAt"` ExpiresAt time.Time `json:"expiresAt"` }
Struct to represent a session stored in Redis
type SessionManager ¶
type SessionManager struct {
// contains filtered or unexported fields
}
struct for SessionManagement through redis
func GetConnection ¶
func GetConnection() (*SessionManager, error)
Get a connection to Redis' SessionManager
func (*SessionManager) CreateSession ¶
func (sm *SessionManager) CreateSession(sessionId string, userId string, duration time.Duration) (*Session, error)
Create a new session in redis!
func (*SessionManager) DeleteSession ¶
func (sm *SessionManager) DeleteSession(sessionId string) error
Remove a session from Redis useful if we need to somehow log everyone out!
func (*SessionManager) ExtendSession ¶
func (sm *SessionManager) ExtendSession(sessionId string, duration time.Duration) error
Extend a session in Redis
func (*SessionManager) GetSession ¶
func (sm *SessionManager) GetSession(sessionId string) (*Session, error)
Retrieve a session from Redis
Click to show internal directories.
Click to hide internal directories.