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

Fix distributed cache document invalidation #16147

Merged
merged 2 commits into from
May 23, 2024

Conversation

mvarblow
Copy link
Contributor

@mvarblow mvarblow commented May 23, 2024

Clear both the distributed cache and the memory cache when invalidating a document. The memory cache is still used (with a 1 second duration) for caching document IDs even when a distributed cache is enabled. Resolves #16146.

Not sure if there are any patches planned for 1.8.x but it would be nice to get this one released soon. It's kind of nasty and a distributed cache seems to be required when running on multiple instances.

Fix #16146
Fix #15678

@MikeAlhayek
Copy link
Member

MikeAlhayek commented May 23, 2024

@mvarblow thank you! I updated the description to tag other issues solved by this PR.

For future reference, I think this code block
https://github.com/OrchardCMS/OrchardCore/pull/16147/files#diff-de7010c8d6be71f61b456105e7d71bde7fbcaf5198af4693dbf1fe1113c5d6a5R335-R339

should be replaced by

await InvalidateInternalAsync(document);

We'll not make that change unless we think it solves another issue.

Hopefully we'll see a PR soon use the new HybridCache introduced by .net 9 and replace the existing 2 level cache (IDistribuitedCache + IMemoryCache)

One thing to note here is that IDistribuitedCache a global and can be accessed by multiple machines. Also object that can be serialized use IDistribuitedCache.

On the other side, IMemoryCache is something that is available on a single machine. This is used for documents that can't be serialized.

@MikeAlhayek MikeAlhayek merged commit b788749 into OrchardCMS:main May 23, 2024
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants