Beispiel #1
0
// remove the entry from the database and then destroy the cacheentry
void InternalCCache::remove(const char* key)
{
  log->debug("removing cache entry with key (%s)", key);

  // lock the cache for writing, which means we know nobody is sitting in find()
  lock->wrlock();

  // grab the entry from the database.
  ISessionCacheEntry* entry = findi(key);

  if (!entry) {
    lock->unlock();
    return;
  }

  // ok, remove the entry and lock it
  m_hashtable.erase(key);
  dynamic_cast<InternalCCacheEntry*>(entry)->lock();
  lock->unlock();

  // we can release the entry lock because we know we're not in the cache anymore
  entry->unlock();

  // Now delete the entry
  delete entry;
}
Beispiel #2
0
void InternalCCache::insert(
    const char* key,
    const IApplication* application,
    const char* client_addr,
    ShibProfile profile,
    const char* providerId,
    SAMLAuthenticationStatement* s,
    SAMLResponse* r,
    const IRoleDescriptor* source,
    time_t created,
    time_t accessed
    )
{
  log->debug("caching new entry for application %s: \"%s\"", application->getId(), key);

  InternalCCacheEntry* entry = new InternalCCacheEntry(
    this,
    key,
    application,
    client_addr,
    profile,
    providerId,
    s,
    r,
    source,
    created,
    accessed
    );

  lock->wrlock();
  m_hashtable[key]=entry;
  lock->unlock();
}