Discover Packages
github.com/fclairamb/dbbat
internal
cache
package
Version:
v0.8.0
Opens a new window with list of versions in this module.
Published: May 6, 2026
License: AGPL-3.0
Opens a new window with license information.
Imports: 7
Opens a new window with list of imports.
Imported by: 0 modules, 0 packages
The first number is the count of modules that contain a package that imports this one.
The module count is a better indicator of popularity than the package count.
A module with 100 importing packages is counted only once instead of 100 times,
reflecting the fact that the choice to use the package was likely made only once,
not 100 times.
A '?' means that the value hasn't been computed yet.
Opens a new window with list of known importers.
Documentation
Documentation
¶
type AuthCache
func (c *AuthCache) Clear()
func (c *AuthCache) Enabled() bool
func (c *AuthCache) Stats() (int64, int64, int)
func (c *AuthCache) VerifyKey(ctx context.Context, keyID, plainKey, storedHash string) (bool, error)
func (c *AuthCache) VerifyPassword(ctx context.Context, userID, password, storedHash string) (bool, error)
type AuthCacheConfig
type AuthCache struct {
}
AuthCache provides caching for password verification results to avoid
expensive argon2id re-computation on every request.
NewAuthCache creates a new authentication cache.
Clear removes all entries from the cache.
Enabled returns whether the cache is enabled.
Stats returns cache statistics: hits, misses, and current size.
VerifyKey verifies a key hash, using cache if available.
keyID is used for logging only.
This method is suitable for API keys and web session keys.
VerifyPassword verifies a password, using cache if available.
userID should be a unique identifier for the user (e.g., UID).
type AuthCacheConfig struct {
Enabled bool
TTLSeconds int
MaxSize int
}
AuthCacheConfig holds configuration for the auth cache.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.