redisstore

package
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: May 3, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package redisstore provides a store.KV session backend built on the native celeris driver/redis client. Sessions are persisted as JSON payloads under a configurable key prefix (default "sess:").

The returned store also implements store.Scanner and store.PrefixDeleter via SCAN + DEL, which the session middleware uses for Reset operations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Options

type Options struct {
	// KeyPrefix is prepended to every session id when reading/writing
	// Redis. Default: "sess:".
	KeyPrefix string

	// ScanCount is the COUNT hint passed to SCAN on Reset/DeletePrefix
	// iterations. Default: 100.
	ScanCount int64
}

Options configure the Redis-backed session store.

type Store

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

Store is a store.KV backed by a *redis.Client. It also satisfies store.Scanner and store.PrefixDeleter.

func New

func New(client *redis.Client, opts ...Options) *Store

New returns a new Redis-backed session store.

func (*Store) Delete

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

Delete implements store.KV.

func (*Store) DeletePrefix

func (s *Store) DeletePrefix(ctx context.Context, prefix string) error

DeletePrefix implements store.PrefixDeleter via SCAN + DEL pipelines.

func (*Store) Get

func (s *Store) Get(ctx context.Context, key string) ([]byte, error)

Get implements store.KV.

func (*Store) Scan

func (s *Store) Scan(ctx context.Context, prefix string) ([]string, error)

Scan implements store.Scanner.

func (*Store) Set

func (s *Store) Set(ctx context.Context, key string, value []byte, ttl time.Duration) error

Set implements store.KV.

Jump to

Keyboard shortcuts

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