cache

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2025 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type TokenValidator

type TokenValidator interface {
	Set(
		token gojwttoken.Token,
		id string,
		value interface{},
		expiresAt time.Time,
	) error
	Has(token gojwttoken.Token, id string) (bool, error)
	Get(token gojwttoken.Token, id string) (interface{}, bool)
	Delete(token gojwttoken.Token, id string) error
}

TokenValidator interface

type TokenValidatorService

type TokenValidatorService struct {
	gocachetimed.Cache
}

TokenValidatorService struct

func NewTokenValidatorService

func NewTokenValidatorService() *TokenValidatorService

NewTokenValidatorService creates a new token validator service

func (*TokenValidatorService) Delete

func (t *TokenValidatorService) Delete(
	token gojwttoken.Token,
	id string,
) error

Delete deletes a token from the cache

func (*TokenValidatorService) Get

func (t *TokenValidatorService) Get(
	token gojwttoken.Token,
	id string,
) (interface{}, bool)

Get gets a token from the cache

func (*TokenValidatorService) GetKey added in v0.4.2

func (t *TokenValidatorService) GetKey(
	token gojwttoken.Token,
	id string,
) (string, error)

GetKey gets the key for the cache

func (*TokenValidatorService) Has

func (t *TokenValidatorService) Has(
	token gojwttoken.Token,
	id string,
) (bool, error)

Has checks if a token exists in the cache

func (*TokenValidatorService) Set

func (t *TokenValidatorService) Set(
	token gojwttoken.Token,
	id string,
	value interface{},
	expiresAt time.Time,
) error

Set sets a token in the cache

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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