inline void CertificateCacheTtl::removeAll() { for(Cache::iterator it = m_cache.begin(); it != m_cache.end(); it++) m_scheduler.cancelEvent(it->second.second); m_cache.clear(); }
inline void CertificateCacheTtl::insert(shared_ptr<const IdentityCertificate> certificate) { time::milliseconds expire = (certificate->getFreshnessPeriod() >= time::seconds::zero() ? certificate->getFreshnessPeriod() : m_defaultTtl); Name index = certificate->getName().getPrefix(-1); Cache::iterator it = m_cache.find(index); if (it != m_cache.end()) m_scheduler.cancelEvent(it->second.second); EventId eventId = m_scheduler.scheduleEvent(expire, bind(&CertificateCacheTtl::remove, this, certificate->getName())); m_cache[index] = std::make_pair(certificate, eventId); }