in algebird-core/src/main/scala/com/twitter/algebird/AdaptiveCache.scala [70:95]
private def update(evicted: Option[Map[K, V]]) = {
evicted.foreach(e => sentinelCache.put(e))
var ret = evicted
if (
currentCapacity < maxCapacity &&
sentinelCache.size > (currentCapacity * growthMargin)
) {
currentCapacity = (currentCapacity * 2).min(maxCapacity)
ret = (ret, summingCache.flush) match {
case (Some(l), Some(r)) => Some(semigroup.plus(l, r))
case (l, None) => l
case (None, r) => r
}
summingCache = new SummingWithHitsCache(currentCapacity)
if (currentCapacity == maxCapacity)
sentinelCache.stopGrowing()
else
sentinelCache.clear()
}
ret
}