cache

package
v0.4.6 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: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Logger added in v0.4.3

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

Logger is the cache token validator logger

func NewLogger added in v0.4.3

func NewLogger(header string, modeLogger gologgermode.Logger) (*Logger, error)

NewLogger creates a new cache token validator logger

func (*Logger) DeleteTokenFromCache added in v0.4.3

func (l *Logger) DeleteTokenFromCache(token gojwttoken.Token, id int64)

DeleteTokenFromCache logs the delete token from cache event

func (*Logger) DeleteTokenFromCacheFailed added in v0.4.3

func (l *Logger) DeleteTokenFromCacheFailed(err error)

DeleteTokenFromCacheFailed logs the delete token from cache failed event

func (*Logger) GetTokenFromCache added in v0.4.3

func (l *Logger) GetTokenFromCache(token gojwttoken.Token, id int64)

GetTokenFromCache logs the get token from cache event

func (*Logger) GetTokenFromCacheFailed added in v0.4.3

func (l *Logger) GetTokenFromCacheFailed(err error)

GetTokenFromCacheFailed logs the get token from cache failed event

func (*Logger) HasTokenInCacheFailed added in v0.4.4

func (l *Logger) HasTokenInCacheFailed(err error)

HasTokenInCacheFailed logs the has token in cache failed event

func (*Logger) SetTokenToCache added in v0.4.3

func (l *Logger) SetTokenToCache(token gojwttoken.Token, id int64)

SetTokenToCache logs the set token to cache event

func (*Logger) SetTokenToCacheFailed added in v0.4.3

func (l *Logger) SetTokenToCacheFailed(err error)

SetTokenToCacheFailed logs the set token to cache failed event

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
	// contains filtered or unexported fields
}

TokenValidatorService struct

func NewTokenValidatorService

func NewTokenValidatorService(logger *Logger) *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