src/Microsoft.IdentityModel.Tokens/EventBasedLRUCache.cs
/// <summary>
/// When the cache is at _maxCapacityPercentage, it needs to be compacted by _compactionPercentage.
/// This method calculates the new size of the cache after being compacted.
/// </summary>
/// <returns>The new target cache size after compaction.</returns>
When the cache is at _maxCapacityPercentage, it needs to be compacted by _compactionPercentage.
This method calculates the new size of the cache after being compacted.
When the cache is at _maxCapacityPercentage it needs to be compacted by _compactionPercentage . This method calculates the new size of the cache after being compacted .
protected int CalculateNewCacheSize()
        {
            int currentCount = Math.Min(_map.Count, _capacity);
            return currentCount - (int)(currentCount * _compactionPercentage);
        }
protected int CalculateNewCacheSize ( ) { int currentCount = Math . Min ( _map . Count , _capacity ) ; return currentCount - ( int ) ( currentCount * _compactionPercentage ) ; }
When the cache is at _maxCapacityPercentage, it needs to be compacted by _compactionPercentage.
When the cache is at _maxCapacityPercentage it needs to be compacted by _compactionPercentage .
// use the smaller of _map.Count and _capacity // use the _capacity for the newCacheSize calculation in the case where the cache is experiencing overflow
The new target cache size after compaction.
The new target cache size after compaction .