Documentation ¶
Index ¶
- Constants
- type InMemoryConfig
- type InMemorySessionManager
- func (mgr *InMemorySessionManager) CreateSession(timeout time.Duration, userUUID, organizationUUID uuid.UUID) (*Session, error)
- func (mgr *InMemorySessionManager) GetSession(sessionUUID uuid.UUID) (*Session, error)
- func (mgr *InMemorySessionManager) RefreshSession(sessionUUID uuid.UUID, timeout time.Duration) (*Session, error)
- type Manager
- type Session
Constants ¶
View Source
const DefaultTimeout time.Duration = 0
DefaultTimeout is used
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type InMemoryConfig ¶
type InMemoryConfig struct { // the timeout duration for a session, default: 24 hours Timeout time.Duration }
InMemoryConfig contains the configuration options for the in-memory cache manager
type InMemorySessionManager ¶
type InMemorySessionManager struct {
// contains filtered or unexported fields
}
InMemorySessionManager is a session manager using an in-memory store
func NewInMemory ¶
func NewInMemory(config InMemoryConfig) (*InMemorySessionManager, error)
NewInMemory returns a new Ristretto session manager
func (*InMemorySessionManager) CreateSession ¶
func (mgr *InMemorySessionManager) CreateSession(timeout time.Duration, userUUID, organizationUUID uuid.UUID) (*Session, error)
CreateSession creates a new in-memory session manager
func (*InMemorySessionManager) GetSession ¶
func (mgr *InMemorySessionManager) GetSession(sessionUUID uuid.UUID) (*Session, error)
GetSession returns a session for a given ID, if it exists
func (*InMemorySessionManager) RefreshSession ¶
func (mgr *InMemorySessionManager) RefreshSession(sessionUUID uuid.UUID, timeout time.Duration) (*Session, error)
RefreshSession returns a session for a given ID, if it exists
type Manager ¶
type Manager interface { // Creates a new session CreateSession(timeout time.Duration, userUUID, organizationUUID uuid.UUID) (*Session, error) // Returns a session for a given ID, or nil if no such session exists GetSession(sessionUUID uuid.UUID) (*Session, error) // Refresh session extends the timeout for a session by timeout RefreshSession(sessionUUID uuid.UUID, timeout time.Duration) (*Session, error) }
Manager is an interface describing a session management system
type Session ¶
type Session struct { UUID uuid.UUID // A temporary API key attached to the session Key []byte // Session will expire after this time. Expires time.Time // The UUID of the user of this session UserUUID uuid.UUID // The UUID of the organization the user belongs to OrganizationUUID uuid.UUID }
Session contains all the data related to a user session
Click to show internal directories.
Click to hide internal directories.