Skip to content
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

HybridCache: ensure that Size is always specified in L1 #5420

Merged
merged 6 commits into from
Sep 18, 2024

Conversation

mgravell
Copy link
Member

@mgravell mgravell commented Sep 12, 2024

Context: dotnet/aspnetcore#57582 - MemoryCache may (opt-in) be enforcing size constraints; to satisfy that scenario, every L1 "set" operation must include an ICacheEntry.Size

(primary review here is probably from aspnetcore; all eyes are welcome, of course)

At first this sounds simple, but it means that we may need to serialize before we set the result, but we want to retain that buffer for the L2 write, which happens after we've supplied the value to the consumer. This requires a little bit of additional gymnastics; lots of comments included. Note also that BufferReleaseTests already has tests to ensure correct buffer release semantics.

Microsoft Reviewers: Open in CodeFlow

@mgravell mgravell marked this pull request as ready for review September 12, 2024 17:37
@mgravell mgravell merged commit c4f3aa8 into dotnet:dev Sep 18, 2024
6 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Oct 19, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants