#include "SquidConfig.h"
#include "SquidTime.h"
-// XXX: reset debugs levels to something sane
-
namespace Auth {
CBDATA_CLASS_INIT(UserNameCache);
UserNameCache::UserNameCache(const char *name) :
cachename(name), cacheCleanupEventName("User cache cleanup: ")
{
- debugs(29, 2, "initializing " << name << " username cache");
+ debugs(29, 5, "initializing " << name << " username cache");
cacheCleanupEventName.append(name);
eventAdd(cacheCleanupEventName.c_str(), &UserNameCache::Cleanup,
this, ::Config.authenticateGCInterval, 1);
Auth::User::Pointer
UserNameCache::lookup(const SBuf &userKey) const
{
- debugs(29, 2, "lookup for " << userKey);
+ debugs(29, 6, "lookup for " << userKey);
auto p = store_.find(userKey);
if (p == store_.end())
return User::Pointer(nullptr);
void
UserNameCache::Cleanup(void *data)
{
- debugs(29, 2, "checkpoint");
+ debugs(29, 5, "checkpoint");
if (!cbdataReferenceValid(data))
return;
// data is this in disguise
// cache entries with expiretime <= expirationTime are to be evicted
const time_t expirationTime = current_time.tv_sec - ::Config.authenticateTTL;
- //XXX for some reason if evicting directly iterators are invalidated
- // trying to defer deletion by using a queue
const auto end = self->store_.end();
for (auto i = self->store_.begin(); i != end;) {
- debugs(29, 2, "considering " << i->first << "(expires in " <<
+ debugs(29, 6, "considering " << i->first << "(expires in " <<
(expirationTime - i->second->expiretime) << " sec)");
if (i->second->expiretime <= expirationTime) {
- debugs(29, 2, "evicting " << i->first);
+ debugs(29, 6, "evicting " << i->first);
i = self->store_.erase(i); //erase advances i
} else {
++i;
void
UserNameCache::insert(Auth::User::Pointer anAuth_user)
{
- debugs(29, 2, "adding " << anAuth_user->SBUserKey());
+ debugs(29, 6, "adding " << anAuth_user->SBUserKey());
store_[anAuth_user->SBUserKey()] = anAuth_user;
}
void
UserNameCache::endingShutdown()
{
- debugs(29, 2, "Shutting down username cache " << cachename);
+ debugs(29, 5, "Shutting down username cache " << cachename);
eventDelete(&UserNameCache::Cleanup, this);
reset();
}
void
UserNameCache::syncConfig()
{
- debugs(29, 2, "Reconfiguring username cache " << cachename);
+ debugs(29, 5, "Reconfiguring username cache " << cachename);
for (auto i : store_) {
aclCacheMatchFlush(&i.second->proxy_match_cache); //flush
}