tokenmutex

package
v0.0.0-...-62b1a13 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrTokenExpired = errors.New("token expired")
View Source
var ErrTokenNotExist = errors.New("token does not exist")

Functions

This section is empty.

Types

type Default

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

func NewDefault

func NewDefault() *Default

func (*Default) Clear

func (d *Default) Clear(ctx context.Context) error

func (*Default) Get

func (d *Default) Get(ctx context.Context) (string, error)

func (*Default) Lock

func (d *Default) Lock(ctx context.Context) error

func (*Default) Set

func (d *Default) Set(ctx context.Context, token string, expiresAt time.Time) error

func (*Default) Unlock

func (d *Default) Unlock(context.Context) error

type Redis

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

func NewRedis

func NewRedis(client *redis.Client, key string) *Redis

func (*Redis) Clear

func (r *Redis) Clear(ctx context.Context) error

func (*Redis) Get

func (r *Redis) Get(context.Context) (string, error)

func (*Redis) Lock

func (r *Redis) Lock(ctx context.Context) error

func (*Redis) Set

func (r *Redis) Set(ctx context.Context, token string, expiresAt time.Time) error

func (*Redis) Unlock

func (r *Redis) Unlock(ctx context.Context) error

Jump to

Keyboard shortcuts

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