1 instantiation of CacheEntry
Microsoft.Extensions.Caching.Memory (1)
MemoryCache.cs (1)
104return new CacheEntry(key, this);
52 references to CacheEntry
Microsoft.Extensions.Caching.Memory (52)
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; 218CacheEntry? parent = _previous; 285var entry = (CacheEntry)state!; 295if ((_tokens == null || !_tokens.CanPropagateTokens()) && _absoluteExpirationTicks < 0 || _current.Value is not CacheEntry parent)
MemoryCache.cs (37)
107internal void SetEntry(CacheEntry entry) 138if (coherentState.TryGetValue(entry.Key, out CacheEntry? priorEntry)) 211coherentState.TryGetValue(key, out CacheEntry? entry); // note we rely on documented "default when fails" contract re the out 228coherentState.TryGetValue(key, out CacheEntry? entry); // note we rely on documented "default when fails" contract re the out 264private bool PostProcessTryGetValue(CoherentState coherentState, CacheEntry? entry, out object? result) 327if (coherentState.TryRemove(key, out CacheEntry? entry)) 349foreach (CacheEntry entry in oldState.GetAllValues()) 377internal void EntryExpired(CacheEntry entry) 485foreach (CacheEntry entry in coherentState.GetAllValues()) 502private bool UpdateCacheSizeExceedsCapacity(CacheEntry entry, CacheEntry? priorEntry, CoherentState coherentState) 597private void Compact(long removalSizeTarget, Func<CacheEntry, long> computeEntrySize, CoherentState coherentState) 599var entriesToRemove = new List<CacheEntry>(); 601var lowPriEntries = new List<(CacheEntry entry, DateTime lastAccessed)>(); 602var normalPriEntries = new List<(CacheEntry entry, DateTime lastAccessed)>(); 603var highPriEntries = new List<(CacheEntry entry, DateTime lastAccessed)>(); 608foreach (CacheEntry entry in coherentState.GetAllValues()) 640foreach (CacheEntry entry in entriesToRemove) 650static void ExpirePriorityBucket(ref long removedSize, long removalSizeTarget, Func<CacheEntry, long> computeEntrySize, List<CacheEntry> entriesToRemove, List<(CacheEntry Entry, DateTime LastAccessed)> priorityEntries) 664foreach ((CacheEntry entry, _) in priorityEntries) 732private readonly ConcurrentDictionary<string, CacheEntry> _stringEntries = []; 736private readonly ConcurrentDictionary<object, CacheEntry> _nonStringEntries = []; 739private readonly ConcurrentDictionary<string, CacheEntry>.AlternateLookup<ReadOnlySpan<char>> _stringAltLookup; 749internal bool TryGetValue(object key, [NotNullWhen(true)] out CacheEntry? entry) 753internal bool TryGetValue(ReadOnlySpan<char> key, [NotNullWhen(true)] out CacheEntry? entry) 758internal bool TryRemove(object key, [NotNullWhen(true)] out CacheEntry? entry) 761internal bool TryAdd(object key, CacheEntry entry) 764internal bool TryUpdate(object key, CacheEntry entry, CacheEntry comparison) 767public IEnumerable<CacheEntry> GetAllValues() 773foreach (KeyValuePair<string, CacheEntry> entry in _stringEntries) 777foreach (KeyValuePair<object, CacheEntry> entry in _nonStringEntries) 785foreach (KeyValuePair<string, CacheEntry> pairs in _stringEntries) 789foreach (KeyValuePair<object, CacheEntry> pairs in _nonStringEntries) 799internal void RemoveEntry(CacheEntry entry, MemoryCacheOptions options)