-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Reduce CacheEntry size #45410
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reduce CacheEntry size #45410
Conversation
…null in DetachTokens
…tes with dependency to MemoryCache 2 fields less for MemoryCache and three for every CacheEntry
…ation and current time
|
Tagging subscribers to this area: @eerhardt, @maryamariyan Issue DetailsI've one more big improvement for the MemoryCache, but it's a little bit controversial so I decided to separate it from reducing the CacheEntry size (this PR). Main changes:
|
src/libraries/Microsoft.Extensions.Caching.Memory/src/CacheEntry.cs
Outdated
Show resolved
Hide resolved
src/libraries/Microsoft.Extensions.Caching.Memory/src/MemoryCache.cs
Outdated
Show resolved
Hide resolved
src/libraries/Microsoft.Extensions.Caching.Memory/src/MemoryCache.cs
Outdated
Show resolved
Hide resolved
src/libraries/Microsoft.Extensions.Caching.Memory/src/CacheEntry.cs
Outdated
Show resolved
Hide resolved
src/libraries/Microsoft.Extensions.Caching.Memory/src/CacheEntry.cs
Outdated
Show resolved
Hide resolved
src/libraries/Microsoft.Extensions.Caching.Memory/src/CacheEntry.cs
Outdated
Show resolved
Hide resolved
src/libraries/Microsoft.Extensions.Caching.Memory/src/CacheEntry.cs
Outdated
Show resolved
Hide resolved
…uteExpiration and current time" because it was causing clock to get called twice This reverts commit f84b6cb. # Conflicts: # src/libraries/Microsoft.Extensions.Caching.Memory/src/CacheEntry.cs
src/libraries/Microsoft.Extensions.Caching.Memory/tests/CacheEntryScopeExpirationTests.cs
Show resolved
Hide resolved
eerhardt
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just had one minor question on the unit test. Other than that, I think this looks good.
|
@eerhardt thanks a lot for the review! |
I've one more big improvement for the MemoryCache, but it's a little bit controversial so I decided to separate it from reducing the CacheEntry size (this PR).
Changes:
_notifyCacheOfExpiration,_notifyCacheEntryCommitand_loggerfrom CacheEntry, replace it with a reference toMemoryCacheand instead of invoking delegates, invoke internal methods._isDisposed,_isExpiredand_valueHasBeenSet) with a single[Flag]field. I did this mostly because I plan to introduce another boolean flag soon.