sessionstore

package
v1.1.16 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2026 License: MPL-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package sessionstore implements the scs.Store interface on top of the cms_sessions table. It exists (rather than using scs's own pgxstore) so the table name carries the cms_ prefix and can live in a database shared with the host application.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Store

type Store struct {
	// contains filtered or unexported fields
}

Store persists sessions in the cms_sessions table.

func New

func New(db *sqldb.DB) *Store

New returns a Store that deletes expired sessions once an hour.

func NewWithCleanupInterval

func NewWithCleanupInterval(db *sqldb.DB, interval time.Duration) *Store

NewWithCleanupInterval returns a Store whose background cleanup runs at the given interval. A zero or negative interval disables cleanup.

func (*Store) Commit

func (s *Store) Commit(token string, data []byte, expiry time.Time) error

Commit inserts or updates a session token with data and expiry.

func (*Store) Delete

func (s *Store) Delete(token string) error

Delete removes a session token.

func (*Store) Find

func (s *Store) Find(token string) ([]byte, bool, error)

Find returns the data for a session token, if present and unexpired.

func (*Store) StopCleanup

func (s *Store) StopCleanup()

StopCleanup halts the background cleanup goroutine, for tests or graceful shutdown. It is safe to call once.

Jump to

Keyboard shortcuts

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