cache

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2026 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthCache

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

AuthCache provides caching for password verification results to avoid expensive argon2id re-computation on every request.

func NewAuthCache

func NewAuthCache(cfg AuthCacheConfig) *AuthCache

NewAuthCache creates a new authentication cache.

func (*AuthCache) Clear

func (c *AuthCache) Clear()

Clear removes all entries from the cache.

func (*AuthCache) Enabled

func (c *AuthCache) Enabled() bool

Enabled returns whether the cache is enabled.

func (*AuthCache) Stats

func (c *AuthCache) Stats() (int64, int64, int)

Stats returns cache statistics: hits, misses, and current size.

func (*AuthCache) VerifyPassword

func (c *AuthCache) VerifyPassword(userID, password, storedHash string) (bool, error)

VerifyPassword verifies a password, using cache if available. userID should be a unique identifier for the user (e.g., UID).

type AuthCacheConfig

type AuthCacheConfig struct {
	Enabled    bool
	TTLSeconds int
	MaxSize    int
}

AuthCacheConfig holds configuration for the auth cache.

Jump to

Keyboard shortcuts

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