mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-20 19:15:54 +00:00
tagged cache expire immediatelly
This commit is contained in:
@@ -299,24 +299,26 @@ TaggedCache<
|
|||||||
{
|
{
|
||||||
std::lock_guard lock(m_mutex);
|
std::lock_guard lock(m_mutex);
|
||||||
|
|
||||||
if (m_target_size == 0 ||
|
// if (m_target_size == 0 ||
|
||||||
(static_cast<int>(m_cache.size()) <= m_target_size))
|
// (static_cast<int>(m_cache.size()) <= m_target_size))
|
||||||
{
|
// {
|
||||||
when_expire = now - m_target_age;
|
// when_expire = now - m_target_age;
|
||||||
}
|
// }
|
||||||
else
|
// else
|
||||||
{
|
// {
|
||||||
when_expire = now - m_target_age * m_target_size / m_cache.size();
|
// when_expire = now - m_target_age * m_target_size / m_cache.size();
|
||||||
|
|
||||||
clock_type::duration const minimumAge(std::chrono::seconds(1));
|
// clock_type::duration const minimumAge(std::chrono::seconds(1));
|
||||||
if (when_expire > (now - minimumAge))
|
// if (when_expire > (now - minimumAge))
|
||||||
when_expire = now - minimumAge;
|
// when_expire = now - minimumAge;
|
||||||
|
|
||||||
JLOG(m_journal.trace())
|
// JLOG(m_journal.trace())
|
||||||
<< m_name << " is growing fast " << m_cache.size() << " of "
|
// << m_name << " is growing fast " << m_cache.size() << " of "
|
||||||
<< m_target_size << " aging at " << (now - when_expire).count()
|
// << m_target_size << " aging at " << (now - when_expire).count()
|
||||||
<< " of " << m_target_age.count();
|
// << " of " << m_target_age.count();
|
||||||
}
|
// }
|
||||||
|
|
||||||
|
when_expire = now + std::chrono::hours(1); // any future time works too to make sure that nothing survives
|
||||||
|
|
||||||
std::vector<std::thread> workers;
|
std::vector<std::thread> workers;
|
||||||
workers.reserve(m_cache.partitions());
|
workers.reserve(m_cache.partitions());
|
||||||
|
|||||||
Reference in New Issue
Block a user