1 instantiation of CacheEntry
Microsoft.Extensions.Caching.Memory (1)
MemoryCache.cs (1)
110return new CacheEntry(key, this);
44 references to CacheEntry
Microsoft.Extensions.Caching.Memory (44)
CacheEntry.CacheEntryTokens.cs (6)
27internal void AttachTokens(CacheEntry cacheEntry) 48internal bool CheckForExpiredTokens(CacheEntry cacheEntry) 68internal void PropagateTokens(CacheEntry parentEntry) 105internal void InvokeEvictionCallbacks(CacheEntry cacheEntry) 109Task.Factory.StartNew(state => InvokeCallbacks((CacheEntry)state!), cacheEntry, 114private 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 47AsyncLocal<CacheEntry?> holder = _current; 54internal static CacheEntry? Current => _current.Value; 214CacheEntry? parent = _previous; 281var entry = (CacheEntry)state!; 291if ((_tokens == null || !_tokens.CanPropagateTokens()) && _absoluteExpirationTicks < 0 || _current.Value is not CacheEntry parent)
MemoryCache.cs (29)
87foreach (KeyValuePair<object, CacheEntry> pairs in _coherentState._entries) 113internal void SetEntry(CacheEntry entry) 144if (coherentState._entries.TryGetValue(entry.Key, out CacheEntry? priorEntry)) 220if (coherentState._entries.TryGetValue(key, out CacheEntry? tmp)) 222CacheEntry entry = tmp; 279if (coherentState._entries.TryRemove(key, out CacheEntry? entry)) 301foreach (KeyValuePair<object, CacheEntry> entry in oldState._entries) 329internal void EntryExpired(CacheEntry entry) 425foreach (KeyValuePair<object, CacheEntry> item in coherentState._entries) 427CacheEntry entry = item.Value; 444private bool UpdateCacheSizeExceedsCapacity(CacheEntry entry, CacheEntry? priorEntry, CoherentState coherentState) 539private void Compact(long removalSizeTarget, Func<CacheEntry, long> computeEntrySize, CoherentState coherentState) 541var entriesToRemove = new List<CacheEntry>(); 543var lowPriEntries = new List<(CacheEntry entry, DateTimeOffset lastAccessed)>(); 544var normalPriEntries = new List<(CacheEntry entry, DateTimeOffset lastAccessed)>(); 545var highPriEntries = new List<(CacheEntry entry, DateTimeOffset lastAccessed)>(); 550foreach (KeyValuePair<object, CacheEntry> item in coherentState._entries) 552CacheEntry entry = item.Value; 583foreach (CacheEntry entry in entriesToRemove) 593static void ExpirePriorityBucket(ref long removedSize, long removalSizeTarget, Func<CacheEntry, long> computeEntrySize, List<CacheEntry> entriesToRemove, List<(CacheEntry Entry, DateTimeOffset LastAccessed)> priorityEntries) 607foreach ((CacheEntry entry, _) in priorityEntries) 679internal ConcurrentDictionary<object, CacheEntry> _entries = new ConcurrentDictionary<object, CacheEntry>(); 682private ICollection<KeyValuePair<object, CacheEntry>> EntriesCollection => _entries; 688internal void RemoveEntry(CacheEntry entry, MemoryCacheOptions options) 690if (EntriesCollection.Remove(new KeyValuePair<object, CacheEntry>(entry.Key, entry)))