1 instantiation of CacheEntry
Microsoft.Extensions.Caching.Memory (1)
MemoryCache.cs (1)
120return new CacheEntry(key, this);
52 references to CacheEntry
Microsoft.Extensions.Caching.Memory (52)
CacheEntry.CacheEntryTokens.cs (6)
41internal void AttachTokens(CacheEntry cacheEntry) 61internal bool CheckForExpiredTokens(CacheEntry cacheEntry) 82internal void PropagateTokens(CacheEntry parentEntry) 113internal void InvokeEvictionCallbacks(CacheEntry cacheEntry) 117Task.Factory.StartNew(state => InvokeCallbacks((CacheEntry)state!), cacheEntry, 122private static void InvokeCallbacks(CacheEntry entry)
CacheEntry.cs (9)
18private static readonly AsyncLocal<CacheEntry?> _current = new AsyncLocal<CacheEntry?>(); 26private CacheEntry? _previous; // this field is not null only before the entry is added to the cache and tracking is enabled 46AsyncLocal<CacheEntry?> holder = _current; 53internal static CacheEntry? Current => _current.Value; 227CacheEntry? parent = _previous; 297var entry = (CacheEntry)state!; 307if ((_tokens == null || !_tokens.CanPropagateTokens()) && _absoluteExpirationTicks < 0 || _current.Value is not CacheEntry parent)
MemoryCache.cs (37)
123internal void SetEntry(CacheEntry entry) 159if (coherentState.TryGetValue(entry.Key, out CacheEntry? priorEntry)) 246coherentState.TryGetValue(key, out CacheEntry? entry); // note we rely on documented "default when fails" contract re the out 263coherentState.TryGetValue(key, out CacheEntry? entry); // note we rely on documented "default when fails" contract re the out 299private bool PostProcessTryGetValue(CoherentState coherentState, CacheEntry? entry, out object? result) 365if (coherentState.TryRemove(key, out CacheEntry? entry)) 387foreach (CacheEntry entry in oldState.GetAllValues()) 416internal void EntryExpired(CacheEntry entry) 528foreach (CacheEntry entry in coherentState.GetAllValues()) 548private bool UpdateCacheSizeExceedsCapacity(CacheEntry entry, CacheEntry? priorEntry, CoherentState coherentState) 647private void Compact(long removalSizeTarget, Func<CacheEntry, long> computeEntrySize, CoherentState coherentState) 649var entriesToRemove = new List<CacheEntry>(); 651var lowPriEntries = new List<(CacheEntry entry, DateTime lastAccessed)>(); 652var normalPriEntries = new List<(CacheEntry entry, DateTime lastAccessed)>(); 653var highPriEntries = new List<(CacheEntry entry, DateTime lastAccessed)>(); 658foreach (CacheEntry entry in coherentState.GetAllValues()) 691foreach (CacheEntry entry in entriesToRemove) 709static void ExpirePriorityBucket(ref long removedSize, long removalSizeTarget, Func<CacheEntry, long> computeEntrySize, List<CacheEntry> entriesToRemove, List<(CacheEntry Entry, DateTime LastAccessed)> priorityEntries) 723foreach ((CacheEntry entry, _) in priorityEntries) 791private readonly ConcurrentDictionary<string, CacheEntry> _stringEntries = []; 795private readonly ConcurrentDictionary<object, CacheEntry> _nonStringEntries = []; 798private readonly ConcurrentDictionary<string, CacheEntry>.AlternateLookup<ReadOnlySpan<char>> _stringAltLookup; 822internal bool TryGetValue(object key, [NotNullWhen(true)] out CacheEntry? entry) 826internal bool TryGetValue(ReadOnlySpan<char> key, [NotNullWhen(true)] out CacheEntry? entry) 831internal bool TryRemove(object key, [NotNullWhen(true)] out CacheEntry? entry) 834internal bool TryAdd(object key, CacheEntry entry) 837internal bool TryUpdate(object key, CacheEntry entry, CacheEntry comparison) 840public IEnumerable<CacheEntry> GetAllValues() 846foreach (KeyValuePair<string, CacheEntry> entry in _stringEntries) 850foreach (KeyValuePair<object, CacheEntry> entry in _nonStringEntries) 858foreach (KeyValuePair<string, CacheEntry> pairs in _stringEntries) 862foreach (KeyValuePair<object, CacheEntry> pairs in _nonStringEntries) 872internal bool RemoveEntry(CacheEntry entry, MemoryCacheOptions options)