tokenStore

package
v1.19.30 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2024 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewTokenStoreFactory added in v1.19.22

func NewTokenStoreFactory[C any](keyPrefix string, getClient func() *redis.Client) func() TokenStore[C]

NewTokenStoreFactory only support maximum 128 partial program instance, and maximum 1 year validate of token.

Types

type Node added in v1.19.22

type Node struct {
	// this is a unique id for each node process, it
	// will be reallocated every day.
	// ID must be smaller than 128.
	ID uint64

	// use for refresh fields.
	Lock       *sync.Mutex
	IDTimeMark uint64
	TokenID    *atomic.Uint64
	// contains filtered or unexported fields
}

func (*Node) WithClient added in v1.19.22

func (node *Node) WithClient(client *redis.Client) NodeWithClient

type NodeWithClient added in v1.19.22

type NodeWithClient struct {
	*Node
	// contains filtered or unexported fields
}

func (NodeWithClient) GenID added in v1.19.22

func (node NodeWithClient) GenID(ctx context.Context) (uint64, error)

type Point

type Point[C any] struct {
	// contains filtered or unexported fields
}

func (Point[C]) Destroy

func (point Point[C]) Destroy(ctx context.Context) error

func (Point[C]) Get

func (point Point[C]) Get(ctx context.Context, claims *C) error

func (Point[C]) GetAndDestroy

func (point Point[C]) GetAndDestroy(ctx context.Context, claims *C) error

type TokenStore

type TokenStore[C any] struct {
	// contains filtered or unexported fields
}

func (TokenStore[C]) CreateStorePoint

func (store TokenStore[C]) CreateStorePoint(ctx context.Context, valid time.Duration, claims *C) (uint64, error)

func (TokenStore[C]) CreateStorePointWithID added in v1.17.36

func (store TokenStore[C]) CreateStorePointWithID(ctx context.Context, id uint64, valid time.Duration, claims *C) error

func (TokenStore[C]) MPointGet added in v1.19.7

func (store TokenStore[C]) MPointGet(ctx context.Context, ids ...uint64) ([]interface{}, error)

func (TokenStore[C]) NewStorePoint

func (store TokenStore[C]) NewStorePoint(id uint64) Point[C]

Jump to

Keyboard shortcuts

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