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

Fixed an issue with settings caching using SettingsRepository #5742

Merged

Conversation

valadas
Copy link
Contributor

@valadas valadas commented Jul 15, 2023

One may have a settings class that includes a mix of HostSettings, PortalSettings, ModuleSettings and TabModuleSettings.

The previous mechanism had different cache keys for PortalId or TabModuleId, but that brought 2 problems:

  1. It is possible to have the same number for a portalId and TabModuleId which would invalidate the wrong cache.
  2. When reading settings using the GetSettings method overload that takes moduleInfo, it would get stale settings for all PortalSettings if it was saved also using moduleInfo overload.

I am on the fence about this PR, but it caches now using always portalId.

PROS: It fixed the issue at hand.

CONS: It clears the portal settings cache to be clear, not the whole portal settings cache but only the specified settings class type being requested. This is maybe a tiny tiny bit of a performance hit, but it's not like saving settings is something that gets hammered.

So I believe the benefits here outweigh the drawbacks.

Closes #5739

Possibly a different fix for the workaround in #3756 but I don't have any MVC custom module to test that part...
Would you like to try removing the previous workaround and test an MVC module to see @donker ?

One may have a settings class that includes a mix of HostSettings, PortalSettings, ModuleSettings and TabModuleSettings.

The previous mechanism had different cache keys for PortalId or TabModuleId, but that brough 2 problems:

1. It is possible to have the same number for a portalId and TabModuleId which would invalidate the wrong cache.
2. When reading settings using the GetSettings method overload that takes moduleInfo, it would get stale settings for all PortalSettings if it was saved also using moduleInfo overload.

I am on the fence about this PR, but it caches now using always portalId.

PROS: It fixed the issue at hand.

CONS: It clears the portal settings cache to be clear, not the whole portal settings cache but only the specifiec settings class type being requested. This is maybe a tiny tiny bit of a performance hit, but it's not like saving settings is something that gets hammerd.

So I believe the benifits here outweigh the drawbacks.

Closes dnnsoftware#5739

Possibly a different fix for the workaround in dnnsoftware#3756 but I don't have any MVC custom module to test that part...
@valadas valadas added this to the 9.12.1 milestone Jul 15, 2023
@mitchelsellers mitchelsellers merged commit 773a7ef into dnnsoftware:develop Jul 15, 2023
3 checks passed
@valadas valadas modified the milestones: 9.12.1, 9.13.0 Aug 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: SettingsRepository pattern clearing cache not always working
3 participants