30 const time::seconds& defaultTtl)
31 : m_defaultTtl(defaultTtl)
44 m_io.dispatch([
this, certificate] { this->insert(certificate); });
47 shared_ptr<const v1::IdentityCertificate>
50 Cache::iterator it =
m_cache.find(certificateName);
52 return it->second.first;
54 return shared_ptr<v1::IdentityCertificate>();
60 m_io.dispatch([
this] { this->removeAll(); });
70 CertificateCacheTtl::insert(shared_ptr<const v1::IdentityCertificate> certificate)
72 time::milliseconds expire = (certificate->getFreshnessPeriod() >= time::seconds::zero() ?
77 Cache::iterator it =
m_cache.find(index);
82 bind(&CertificateCacheTtl::remove,
83 this, certificate->getName()));
85 m_cache[index] = std::make_pair(certificate, eventId);
89 CertificateCacheTtl::remove(
const Name& certificateName)
92 Cache::iterator it =
m_cache.find(name);
98 CertificateCacheTtl::removeAll()
100 for(Cache::iterator it =
m_cache.begin(); it !=
m_cache.end(); it++)
Copyright (c) 2013-2016 Regents of the University of California.
CertificateCacheTtl(boost::asio::io_service &io, const time::seconds &defaultTtl=time::seconds(3600))
virtual void insertCertificate(shared_ptr< const v1::IdentityCertificate > certificate)
boost::asio::io_service & m_io
virtual ~CertificateCacheTtl()
Name abstraction to represent an absolute name.
virtual shared_ptr< const v1::IdentityCertificate > getCertificate(const Name &certificateNameWithoutVersion)
PartialName getPrefix(ssize_t nComponents) const
Extract a prefix (PartialName) of the name, containing first nComponents components.
time::seconds m_defaultTtl