src/Microsoft.IdentityModel.Tokens/EventBasedLRUCache.cs
/// <summary>
/// Remove items from the LinkedList by the desired compaction percentage.
/// This should be a private method.
/// </summary>
Remove items from the LinkedList by the desired compaction percentage.
This should be a private method.
Remove items from the LinkedList by the desired compaction percentage . This should be a private method .
private void CompactLRU()
        {
            var newCacheSize = CalculateNewCacheSize();
            while (_map.Count > newCacheSize && _doubleLinkedList.Count > 0)
            {
                var lru = _doubleLinkedList.Last;
                if (_map.TryRemove(lru.Value.Key, out var cacheItem))
                    OnItemRemoved?.Invoke(cacheItem.Value);
                _doubleLinkedList.RemoveLast();
            }
        }
private void CompactLRU ( ) { var newCacheSize = CalculateNewCacheSize ( ) ; while ( _map . Count > newCacheSize && _doubleLinkedList . Count > 0 ) { var lru = _doubleLinkedList . Last ; if ( _map . TryRemove ( lru . Value . Key , out var cacheItem ) ) OnItemRemoved ? . Invoke ( cacheItem . Value ) ; _doubleLinkedList . RemoveLast ( ) ; } }
Remove items from the LinkedList by the desired compaction percentage.
Remove items from the LinkedList by the desired compaction percentage .