kvs

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package kvs provides a session storage backend using kvs.ListableStore.

This adapter allows any kvs.ListableStore (Redis, SQLite, etc.) to be used as a session storage backend.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewWithControls

func NewWithControls(backend kvs.ListableStore, cfg session.Config, opts ...session.ControlOption) session.Store

NewWithControls creates a new KVS-backed session store with controls. This is a convenience function that wraps New() with WithControls().

Types

type Store

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

Store implements session.Store using a kvs.ListableStore backend.

func New

func New(backend kvs.ListableStore, cfg session.Config) *Store

New creates a new KVS-backed session store.

func (*Store) Close

func (s *Store) Close() error

Close closes the store.

func (*Store) Create

func (s *Store) Create(ctx context.Context, sess *session.Session) error

Create stores a new session.

func (*Store) Delete

func (s *Store) Delete(ctx context.Context, id string) error

Delete removes a session by ID.

func (*Store) DeleteByUserID

func (s *Store) DeleteByUserID(ctx context.Context, userID string) (int, error)

DeleteByUserID removes all sessions for a user.

func (*Store) Get

func (s *Store) Get(ctx context.Context, id string) (*session.Session, error)

Get retrieves a session by ID.

func (*Store) ListByUserID

func (s *Store) ListByUserID(ctx context.Context, userID string) ([]*session.Session, error)

ListByUserID returns all sessions for a user, sorted by CreatedAt ascending (oldest first).

func (*Store) Touch

func (s *Store) Touch(ctx context.Context, id string) error

Touch updates the LastAccessedAt timestamp.

func (*Store) Update

func (s *Store) Update(ctx context.Context, sess *session.Session) error

Update updates an existing session.

Jump to

Keyboard shortcuts

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