Cache of Auth::User credentials, keyed by Auth::User::userKey. More...
#include <CredentialsCache.h>
Public Member Functions | |
CredentialsCache (const char *name, const char *const eventName) | |
~CredentialsCache ()=default | |
CredentialsCache (const CredentialsCache &)=delete | |
CredentialsCache & | operator= (const CredentialsCache &)=delete |
Auth::User::Pointer | lookup (const SBuf &userKey) const |
void | insert (const SBuf &userKey, Auth::User::Pointer anAuth_user) |
add an user to the cache with the provided key More... | |
void | reset () |
clear cache More... | |
size_t | size () const |
void | cleanup () |
cache garbage collection, removes timed-out entries More... | |
void | doConfigChangeCleanup () |
std::vector< Auth::User::Pointer > | sortedUsersList () const |
Static Public Member Functions | |
static void | Cleanup (void *) |
Private Types | |
typedef std::unordered_map< SBuf, Auth::User::Pointer > | StoreType |
key is User::userKey(), mapped value is User::Pointer More... | |
Private Member Functions | |
CBDATA_CLASS (CredentialsCache) | |
void | scheduleCleanup () |
Private Attributes | |
bool | gcScheduled_ |
whether a cleanup (garbage collection) event has been scheduled More... | |
StoreType | store_ |
const char *const | cacheCleanupEventName |
Detailed Description
Definition at line 21 of file CredentialsCache.h.
Member Typedef Documentation
◆ StoreType
|
private |
Definition at line 70 of file CredentialsCache.h.
Constructor & Destructor Documentation
◆ CredentialsCache() [1/2]
|
explicit |
Definition at line 56 of file CredentialsCache.cc.
References debugs, and RegisterRunner().
◆ ~CredentialsCache()
|
default |
◆ CredentialsCache() [2/2]
|
delete |
Member Function Documentation
◆ CBDATA_CLASS()
|
private |
◆ cleanup()
void Auth::CredentialsCache::cleanup | ( | ) |
Definition at line 84 of file CredentialsCache.cc.
References Auth::Config::credentialsTtl, current_time, debugs, gcScheduled_, scheduleCleanup(), store_, and Auth::TheConfig.
Referenced by Cleanup(), and doConfigChangeCleanup().
◆ Cleanup()
|
static |
periodic cleanup function, removes timed-out entries
Must be static to support EVH interface. Argument will be this
Definition at line 75 of file CredentialsCache.cc.
References cleanup(), and debugs.
Referenced by scheduleCleanup().
◆ doConfigChangeCleanup()
void Auth::CredentialsCache::doConfigChangeCleanup | ( | ) |
Cleanup cache data after a reconfiguration has occurred. Similar to cleanup() but also flushes stale config dependent state from retained entries.
Definition at line 140 of file CredentialsCache.cc.
References aclCacheMatchFlush(), cleanup(), and store_.
◆ insert()
void Auth::CredentialsCache::insert | ( | const SBuf & | userKey, |
Auth::User::Pointer | anAuth_user | ||
) |
Definition at line 105 of file CredentialsCache.cc.
References debugs, scheduleCleanup(), and store_.
◆ lookup()
Auth::User::Pointer Auth::CredentialsCache::lookup | ( | const SBuf & | userKey | ) | const |
- Returns
- a pointer to cached credentials, or nil if none found
Definition at line 65 of file CredentialsCache.cc.
◆ operator=()
|
delete |
◆ reset()
|
inline |
Definition at line 39 of file CredentialsCache.h.
References store_.
◆ scheduleCleanup()
|
private |
Definition at line 130 of file CredentialsCache.cc.
References cacheCleanupEventName, Cleanup(), eventAdd(), gcScheduled_, store_, and Auth::TheConfig.
◆ size()
|
inline |
- Returns
- number of cached usernames
Definition at line 42 of file CredentialsCache.h.
References store_.
Referenced by sortedUsersList().
◆ sortedUsersList()
std::vector< Auth::User::Pointer > Auth::CredentialsCache::sortedUsersList | ( | ) | const |
- Returns
- alphanumerically sorted list of usernames
Definition at line 115 of file CredentialsCache.cc.
Member Data Documentation
◆ cacheCleanupEventName
|
private |
Definition at line 74 of file CredentialsCache.h.
Referenced by scheduleCleanup().
◆ gcScheduled_
|
private |
Definition at line 67 of file CredentialsCache.h.
Referenced by cleanup(), and scheduleCleanup().
◆ store_
|
private |
Definition at line 71 of file CredentialsCache.h.
Referenced by cleanup(), doConfigChangeCleanup(), insert(), lookup(), reset(), scheduleCleanup(), size(), and sortedUsersList().
The documentation for this class was generated from the following files:
- src/auth/CredentialsCache.h
- src/auth/CredentialsCache.cc