Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var AuthCache = NewUserAuthCache()
AuthCache is a global cache instance used to store and manage user authentication states efficiently.
LocalCache is a cache object with a default expiration duration of 5 minutes and a cleanup interval of 10 minutes.
Functions ¶
This section is empty.
Types ¶
type ShardedCache ¶ added in v1.7.1
type ShardedCache struct {
// contains filtered or unexported fields
}
ShardedCache is a cache that is split into multiple shards to reduce mutex contention Each shard has its own mutex, allowing for better concurrency
func NewShardedCache ¶ added in v1.7.1
func NewShardedCache(numShards int) *ShardedCache
NewShardedCache creates a new sharded cache with the specified number of shards
type UserAuthCache ¶ added in v1.7.1
type UserAuthCache struct {
// contains filtered or unexported fields
}
UserAuthCache is a cache for authentication results It stores whether a user has been successfully authenticated It can be used by both LDAP and Lua backends
func NewUserAuthCache ¶ added in v1.7.1
func NewUserAuthCache() *UserAuthCache
NewUserAuthCache creates a new UserAuthCache
func (*UserAuthCache) Clear ¶ added in v1.7.1
func (c *UserAuthCache) Clear()
Clear removes all entries from the cache
func (*UserAuthCache) Delete ¶ added in v1.7.1
func (c *UserAuthCache) Delete(username string)
Delete removes an entry from the cache
func (*UserAuthCache) Get ¶ added in v1.7.1
func (c *UserAuthCache) Get(username string) (bool, bool)
Get retrieves an entry from the cache Returns the authentication status and whether the entry was found
func (*UserAuthCache) IsAuthenticated ¶ added in v1.7.1
func (c *UserAuthCache) IsAuthenticated(username string) bool
IsAuthenticated checks if a user is authenticated Returns true if the user is in the cache and authenticated
func (*UserAuthCache) Set ¶ added in v1.7.1
func (c *UserAuthCache) Set(username string, authenticated bool)
Set adds or updates an entry in the cache