Documentation
¶
Index ¶
- type SessionRepository
- func (r *SessionRepository) Count() (int, error)
- func (r *SessionRepository) Create(sess *session.Session) error
- func (r *SessionRepository) Delete(id string) error
- func (r *SessionRepository) DeleteByUserID(userID string) error
- func (r *SessionRepository) DeleteExpired() error
- func (r *SessionRepository) ExistsByID(id string) (bool, error)
- func (r *SessionRepository) ExistsByToken(token string) (bool, error)
- func (r *SessionRepository) FindByID(id string) (*session.Session, error)
- func (r *SessionRepository) FindByToken(token string) (*session.Session, error)
- func (r *SessionRepository) FindByUserID(userID string) ([]*session.Session, error)
- func (r *SessionRepository) Update(sess *session.Session) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type SessionRepository ¶
type SessionRepository struct {
// contains filtered or unexported fields
}
SessionRepository wraps a session repository with secondary storage caching It caches session lookups by token to reduce database load
func NewSessionRepository ¶
func NewSessionRepository( primary session.Repository, secondary storage.SecondaryStorage, ) *SessionRepository
NewSessionRepository creates a new cached session repository
func (*SessionRepository) Count ¶
func (r *SessionRepository) Count() (int, error)
Count returns the total number of sessions
func (*SessionRepository) Create ¶
func (r *SessionRepository) Create(sess *session.Session) error
Create creates a new session and caches it
func (*SessionRepository) Delete ¶
func (r *SessionRepository) Delete(id string) error
Delete deletes a session by ID and removes from cache
func (*SessionRepository) DeleteByUserID ¶
func (r *SessionRepository) DeleteByUserID(userID string) error
DeleteByUserID deletes all sessions for a user
func (*SessionRepository) DeleteExpired ¶
func (r *SessionRepository) DeleteExpired() error
DeleteExpired deletes all expired sessions
func (*SessionRepository) ExistsByID ¶
func (r *SessionRepository) ExistsByID(id string) (bool, error)
ExistsByID checks if a session exists by ID
func (*SessionRepository) ExistsByToken ¶
func (r *SessionRepository) ExistsByToken(token string) (bool, error)
ExistsByToken checks if a session exists by token, checking cache first
func (*SessionRepository) FindByID ¶
func (r *SessionRepository) FindByID(id string) (*session.Session, error)
FindByID retrieves a session by ID from primary storage
func (*SessionRepository) FindByToken ¶
func (r *SessionRepository) FindByToken(token string) (*session.Session, error)
FindByToken retrieves a session by token, checking cache first
func (*SessionRepository) FindByUserID ¶
func (r *SessionRepository) FindByUserID(userID string) ([]*session.Session, error)
FindByUserID retrieves all sessions for a user from primary storage