redis

package
v0.0.0-...-d630f0f Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultTTL = time.Hour

DefaultTTL default ttl

Variables

View Source
var ErrNotfound = errors.New("not found")

ErrNotfound not found error

Functions

This section is empty.

Types

type Mgr

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

Mgr token manager

func NewManager

func NewManager(cfg RedisConf, ttl time.Duration) *Mgr

NewManager new token manager

func (*Mgr) Get

func (m *Mgr) Get(uid string, tk token.Token) error

Get get token by uid

func (*Mgr) Revoke

func (m *Mgr) Revoke(uid, tk string)

Revoke revoke token

func (*Mgr) Save

func (m *Mgr) Save(tk token.Token) error

Save save token

func (*Mgr) Verify

func (m *Mgr) Verify(tk token.Token) (bool, error)

Verify verify token

type RedisConf

type RedisConf struct {
	Addrs    []string
	User     string
	Password string
	DB       int
	Prefix   string
}

RedisConf redis config

Jump to

Keyboard shortcuts

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