redis

package
v1.0.20 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package redis implements the TokenStore interface using Redis. To use this package, you need to enable the "redis" build tag.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewTokenStore

func NewTokenStore(client *redis.Client, prefix string) cache.TokenStore

NewTokenStore creates a new TokenStore which implements a cache.TokenStore instance. It uses Redis as the underlying storage.

Types

type TokenStore

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

TokenStore implements the TokenStore interface using Redis

func (*TokenStore) Clear

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

Clear removes all tokens from Redis

func (*TokenStore) Close

func (r *TokenStore) Close() error

Close closes the Redis client

func (*TokenStore) Count

func (r *TokenStore) Count(ctx context.Context) int

Count returns the number of tokens in Redis

func (*TokenStore) Delete

func (r *TokenStore) Delete(ctx context.Context, token string) error

Delete removes a token from Redis

func (*TokenStore) DeleteExpired

func (r *TokenStore) DeleteExpired(ctx context.Context) error

DeleteExpired removes all expired tokens from Redis

func (*TokenStore) Get

func (r *TokenStore) Get(ctx context.Context, tokenValue string) (*cache.TokenEntry, error)

Get retrieves a token entry from Redis

func (*TokenStore) Set

func (r *TokenStore) Set(ctx context.Context, entry *cache.TokenEntry) error

Set stores a token with its claims and expiry time in Redis

Jump to

Keyboard shortcuts

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