1 instantiation of CacheEntry
Microsoft.Extensions.Caching.Memory (1)
MemoryCache.cs (1)
109return new CacheEntry(key, this);
43 references to CacheEntry
Microsoft.Extensions.Caching.Memory (43)
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 (28)
86foreach (KeyValuePair<object, CacheEntry> pairs in _coherentState._entries) 112internal void SetEntry(CacheEntry entry) 143if (coherentState._entries.TryGetValue(entry.Key, out CacheEntry? priorEntry)) 227if (coherentState._entries.TryGetValue(key, out CacheEntry? tmp)) 229CacheEntry entry = tmp; 286if (coherentState._entries.TryRemove(key, out CacheEntry? entry)) 308foreach (KeyValuePair<object, CacheEntry> entry in oldState._entries) 336internal void EntryExpired(CacheEntry entry) 432foreach (KeyValuePair<object, CacheEntry> item in coherentState._entries) 434CacheEntry entry = item.Value; 447private bool UpdateCacheSizeExceedsCapacity(CacheEntry entry, CoherentState coherentState) 522private void Compact(long removalSizeTarget, Func<CacheEntry, long> computeEntrySize, CoherentState coherentState) 524var entriesToRemove = new List<CacheEntry>(); 526var lowPriEntries = new List<(CacheEntry entry, DateTimeOffset lastAccessed)>(); 527var normalPriEntries = new List<(CacheEntry entry, DateTimeOffset lastAccessed)>(); 528var highPriEntries = new List<(CacheEntry entry, DateTimeOffset lastAccessed)>(); 533foreach (KeyValuePair<object, CacheEntry> item in coherentState._entries) 535CacheEntry entry = item.Value; 566foreach (CacheEntry entry in entriesToRemove) 576static void ExpirePriorityBucket(ref long removedSize, long removalSizeTarget, Func<CacheEntry, long> computeEntrySize, List<CacheEntry> entriesToRemove, List<(CacheEntry Entry, DateTimeOffset LastAccessed)> priorityEntries) 590foreach ((CacheEntry entry, _) in priorityEntries) 662internal ConcurrentDictionary<object, CacheEntry> _entries = new ConcurrentDictionary<object, CacheEntry>(); 665private ICollection<KeyValuePair<object, CacheEntry>> EntriesCollection => _entries; 671internal void RemoveEntry(CacheEntry entry, MemoryCacheOptions options) 673if (EntriesCollection.Remove(new KeyValuePair<object, CacheEntry>(entry.Key, entry)))