1 instantiation of CacheEntry
Microsoft.Extensions.Caching.Memory (1)
MemoryCache.cs (1)
104
return new
CacheEntry
(key, this);
55 references to CacheEntry
Microsoft.Extensions.Caching.Memory (55)
CacheEntry.CacheEntryTokens.cs (6)
27
internal void AttachTokens(
CacheEntry
cacheEntry)
48
internal bool CheckForExpiredTokens(
CacheEntry
cacheEntry)
68
internal void PropagateTokens(
CacheEntry
parentEntry)
105
internal void InvokeEvictionCallbacks(
CacheEntry
cacheEntry)
109
Task.Factory.StartNew(state => InvokeCallbacks((
CacheEntry
)state!), cacheEntry,
114
private static void InvokeCallbacks(
CacheEntry
entry)
CacheEntry.cs (9)
18
private static readonly AsyncLocal<
CacheEntry
?> _current = new AsyncLocal<
CacheEntry
?>();
26
private
CacheEntry
? _previous; // this field is not null only before the entry is added to the cache and tracking is enabled
47
AsyncLocal<
CacheEntry
?> holder = _current;
54
internal static
CacheEntry
? Current => _current.Value;
214
CacheEntry
? parent = _previous;
281
var
entry = (
CacheEntry
)state!;
291
if ((_tokens == null || !_tokens.CanPropagateTokens()) && _absoluteExpirationTicks < 0 || _current.Value is not
CacheEntry
parent)
MemoryCache.cs (40)
107
internal void SetEntry(
CacheEntry
entry)
138
if (coherentState.TryGetValue(entry.Key, out
CacheEntry
? priorEntry))
214
if (coherentState.TryGetValue(key, out
CacheEntry
? tmp))
216
CacheEntry
entry = tmp;
274
if (coherentState.TryRemove(key, out
CacheEntry
? entry))
296
foreach (
CacheEntry
entry in oldState.GetAllValues())
324
internal void EntryExpired(
CacheEntry
entry)
421
foreach (
CacheEntry
entry in coherentState.GetAllValues())
438
private bool UpdateCacheSizeExceedsCapacity(
CacheEntry
entry,
CacheEntry
? priorEntry, CoherentState coherentState)
533
private void Compact(long removalSizeTarget, Func<
CacheEntry
, long> computeEntrySize, CoherentState coherentState)
535
var entriesToRemove = new List<
CacheEntry
>();
537
var lowPriEntries = new List<(
CacheEntry
entry, DateTimeOffset lastAccessed)>();
538
var normalPriEntries = new List<(
CacheEntry
entry, DateTimeOffset lastAccessed)>();
539
var highPriEntries = new List<(
CacheEntry
entry, DateTimeOffset lastAccessed)>();
544
foreach (
CacheEntry
entry in coherentState.GetAllValues())
576
foreach (
CacheEntry
entry in entriesToRemove)
586
static void ExpirePriorityBucket(ref long removedSize, long removalSizeTarget, Func<
CacheEntry
, long> computeEntrySize, List<
CacheEntry
> entriesToRemove, List<(
CacheEntry
Entry, DateTimeOffset LastAccessed)> priorityEntries)
600
foreach ((
CacheEntry
entry, _) in priorityEntries)
672
private readonly ConcurrentDictionary<string,
CacheEntry
> _stringEntries = new ConcurrentDictionary<string,
CacheEntry
>(StringKeyComparer.Instance);
673
private readonly ConcurrentDictionary<object,
CacheEntry
> _nonStringEntries = new ConcurrentDictionary<object,
CacheEntry
>();
676
internal bool TryGetValue(object key, [NotNullWhen(true)] out
CacheEntry
? entry)
679
internal bool TryRemove(object key, [NotNullWhen(true)] out
CacheEntry
? entry)
682
internal bool TryAdd(object key,
CacheEntry
entry)
685
internal bool TryUpdate(object key,
CacheEntry
entry,
CacheEntry
comparison)
688
public IEnumerable<
CacheEntry
> GetAllValues()
694
foreach (KeyValuePair<string,
CacheEntry
> entry in _stringEntries)
698
foreach (KeyValuePair<object,
CacheEntry
> entry in _nonStringEntries)
706
foreach (KeyValuePair<string,
CacheEntry
> pairs in _stringEntries)
710
foreach (KeyValuePair<object,
CacheEntry
> pairs in _nonStringEntries)
716
private ICollection<KeyValuePair<string,
CacheEntry
>> StringEntriesCollection => _stringEntries;
717
private ICollection<KeyValuePair<object,
CacheEntry
>> NonStringEntriesCollection => _nonStringEntries;
723
internal void RemoveEntry(
CacheEntry
entry, MemoryCacheOptions options)
727
if (StringEntriesCollection.Remove(new KeyValuePair<string,
CacheEntry
>(s, entry)))
736
else if (NonStringEntriesCollection.Remove(new KeyValuePair<object,
CacheEntry
>(entry.Key, entry)))