Documentation
¶
Overview ¶
Package redis implements the TokenStore interface using Redis. To use this package, you need to enable the "redis" build tag.
Index ¶
- func NewTokenStore(client *redis.Client, prefix string) cache.TokenStore
- type TokenStore
- func (r *TokenStore) Clear(ctx context.Context) error
- func (r *TokenStore) Close() error
- func (r *TokenStore) Count(ctx context.Context) int
- func (r *TokenStore) Delete(ctx context.Context, token string) error
- func (r *TokenStore) DeleteExpired(ctx context.Context) error
- func (r *TokenStore) Get(ctx context.Context, tokenValue string) (*cache.TokenEntry, error)
- func (r *TokenStore) Set(ctx context.Context, entry *cache.TokenEntry) error
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) 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
Click to show internal directories.
Click to hide internal directories.