rueidisstore

package module
v0.0.0-...-c60d03e Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2025 License: Apache-2.0 Imports: 4 Imported by: 0

README

rueidisstore

A rueidis bases session store for scs

Setup

You should follow the instructions to set a client, and pass the client to rueidisstore.New() or rueidisstore.NewWithPrefix() to establish the session store.

Keys

Default key is scs:session:, you can change it via

sessionManagerOne.Store = rueidisstore.NewWithPrefix(client, "scs:session:1:")

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RueidisStore

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

RueidisStore the session store

func New

func New(client rueidis.Client) *RueidisStore

New returns a new RueidisStore instance

func NewWithPrefix

func NewWithPrefix(client rueidis.Client, prefix string) *RueidisStore

NewWithPrefix returns a new RueidisStore instance

func (*RueidisStore) AllCtx

func (ru *RueidisStore) AllCtx(ctx context.Context) (map[string][]byte, error)

AllCtx returns a map containing the token and data for all active (i.e. not expired) sessions in the RueidisStore instance.

func (*RueidisStore) Commit

func (ru *RueidisStore) Commit(token string, b []byte, expiry time.Time) error

Commit don't use

func (*RueidisStore) CommitCtx

func (ru *RueidisStore) CommitCtx(ctx context.Context, token string, b []byte, expiry time.Time) error

CommitCtx adds a session token and data to the RueidisStore instance with the given expiry time. If the session token already exists then the data and expiry time are updated.

func (*RueidisStore) Delete

func (ru *RueidisStore) Delete(token string) error

Delete don't use

func (*RueidisStore) DeleteCtx

func (ru *RueidisStore) DeleteCtx(ctx context.Context, token string) error

DeleteCtx removes a session token and corresponding data from the RueidisStore instance.

func (*RueidisStore) Find

func (ru *RueidisStore) Find(token string) ([]byte, bool, error)

Find don't use

func (*RueidisStore) FindCtx

func (ru *RueidisStore) FindCtx(ctx context.Context, token string) ([]byte, bool, error)

FindCtx returns the data for a given session token from the RueidisStore instance. If the session token is not found or is expired, the returned exists flag will be set to false.

Jump to

Keyboard shortcuts

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