Cache of Auth::User credentials, keyed by Auth::User::userKey. More...

#include <CredentialsCache.h>

Collaboration diagram for Auth::CredentialsCache:

Public Member Functions

 CredentialsCache (const char *name, const char *const eventName)
 
 ~CredentialsCache ()=default
 
 CredentialsCache (const CredentialsCache &)=delete
 
CredentialsCacheoperator= (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::PointersortedUsersList () const
 

Static Public Member Functions

static void Cleanup (void *)
 

Private Types

typedef std::unordered_map< SBuf, Auth::User::PointerStoreType
 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

typedef std::unordered_map<SBuf, Auth::User::Pointer> Auth::CredentialsCache::StoreType
private

Definition at line 70 of file CredentialsCache.h.

Constructor & Destructor Documentation

◆ CredentialsCache() [1/2]

Auth::CredentialsCache::CredentialsCache ( const char *  name,
const char *const  eventName 
)
explicit

Definition at line 56 of file CredentialsCache.cc.

References debugs, and RegisterRunner().

◆ ~CredentialsCache()

Auth::CredentialsCache::~CredentialsCache ( )
default

◆ CredentialsCache() [2/2]

Auth::CredentialsCache::CredentialsCache ( const CredentialsCache )
delete

Member Function Documentation

◆ CBDATA_CLASS()

Auth::CredentialsCache::CBDATA_CLASS ( CredentialsCache  )
private

◆ cleanup()

void Auth::CredentialsCache::cleanup ( )

◆ Cleanup()

void Auth::CredentialsCache::Cleanup ( void *  data)
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.

References debugs, and store_.

◆ operator=()

CredentialsCache & Auth::CredentialsCache::operator= ( const CredentialsCache )
delete

◆ reset()

void Auth::CredentialsCache::reset ( )
inline

Definition at line 39 of file CredentialsCache.h.

References store_.

◆ scheduleCleanup()

void Auth::CredentialsCache::scheduleCleanup ( )
private

Definition at line 130 of file CredentialsCache.cc.

References cacheCleanupEventName, Cleanup(), eventAdd(), gcScheduled_, store_, and Auth::TheConfig.

Referenced by cleanup(), and insert().

◆ size()

size_t Auth::CredentialsCache::size ( ) const
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.

References size(), and store_.

Member Data Documentation

◆ cacheCleanupEventName

const char* const Auth::CredentialsCache::cacheCleanupEventName
private

Definition at line 74 of file CredentialsCache.h.

Referenced by scheduleCleanup().

◆ gcScheduled_

bool Auth::CredentialsCache::gcScheduled_
private

Definition at line 67 of file CredentialsCache.h.

Referenced by cleanup(), and scheduleCleanup().

◆ store_

StoreType Auth::CredentialsCache::store_
private

The documentation for this class was generated from the following files:

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors