1 instantiation of CacheEntry
Microsoft.Extensions.Caching.Memory (1)
MemoryCache.cs (1)
120
return new
CacheEntry
(key, this);
52 references to CacheEntry
Microsoft.Extensions.Caching.Memory (52)
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 (37)
123
internal void SetEntry(
CacheEntry
entry)
154
if (coherentState.TryGetValue(entry.Key, out
CacheEntry
? priorEntry))
227
coherentState.TryGetValue(key, out
CacheEntry
? entry); // note we rely on documented "default when fails" contract re the out
244
coherentState.TryGetValue(key, out
CacheEntry
? entry); // note we rely on documented "default when fails" contract re the out
280
private bool PostProcessTryGetValue(CoherentState coherentState,
CacheEntry
? entry, out object? result)
346
if (coherentState.TryRemove(key, out
CacheEntry
? entry))
368
foreach (
CacheEntry
entry in oldState.GetAllValues())
397
internal void EntryExpired(
CacheEntry
entry)
509
foreach (
CacheEntry
entry in coherentState.GetAllValues())
529
private bool UpdateCacheSizeExceedsCapacity(
CacheEntry
entry,
CacheEntry
? priorEntry, CoherentState coherentState)
624
private void Compact(long removalSizeTarget, Func<
CacheEntry
, long> computeEntrySize, CoherentState coherentState)
626
var entriesToRemove = new List<
CacheEntry
>();
628
var lowPriEntries = new List<(
CacheEntry
entry, DateTime lastAccessed)>();
629
var normalPriEntries = new List<(
CacheEntry
entry, DateTime lastAccessed)>();
630
var highPriEntries = new List<(
CacheEntry
entry, DateTime lastAccessed)>();
635
foreach (
CacheEntry
entry in coherentState.GetAllValues())
668
foreach (
CacheEntry
entry in entriesToRemove)
686
static void ExpirePriorityBucket(ref long removedSize, long removalSizeTarget, Func<
CacheEntry
, long> computeEntrySize, List<
CacheEntry
> entriesToRemove, List<(
CacheEntry
Entry, DateTime LastAccessed)> priorityEntries)
700
foreach ((
CacheEntry
entry, _) in priorityEntries)
768
private readonly ConcurrentDictionary<string,
CacheEntry
> _stringEntries = [];
772
private readonly ConcurrentDictionary<object,
CacheEntry
> _nonStringEntries = [];
775
private readonly ConcurrentDictionary<string,
CacheEntry
>.AlternateLookup<ReadOnlySpan<char>> _stringAltLookup;
785
internal bool TryGetValue(object key, [NotNullWhen(true)] out
CacheEntry
? entry)
789
internal bool TryGetValue(ReadOnlySpan<char> key, [NotNullWhen(true)] out
CacheEntry
? entry)
794
internal bool TryRemove(object key, [NotNullWhen(true)] out
CacheEntry
? entry)
797
internal bool TryAdd(object key,
CacheEntry
entry)
800
internal bool TryUpdate(object key,
CacheEntry
entry,
CacheEntry
comparison)
803
public IEnumerable<
CacheEntry
> GetAllValues()
809
foreach (KeyValuePair<string,
CacheEntry
> entry in _stringEntries)
813
foreach (KeyValuePair<object,
CacheEntry
> entry in _nonStringEntries)
821
foreach (KeyValuePair<string,
CacheEntry
> pairs in _stringEntries)
825
foreach (KeyValuePair<object,
CacheEntry
> pairs in _nonStringEntries)
835
internal bool RemoveEntry(
CacheEntry
entry, MemoryCacheOptions options)