-
Notifications
You must be signed in to change notification settings - Fork 85
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
Disambiguate cache key for similarly named models #140
Conversation
Two models with the same name in different apps would previously get the same cache key. Including the model's module in the cache key fixes this.
@ahumeau Could you provide a unit test? |
@johnthagen sure :). |
@@ -64,7 +64,7 @@ def set_to_cache(self) -> None: | |||
@classmethod | |||
def get_cache_key(cls) -> str: | |||
prefix = getattr(settings, "SOLO_CACHE_PREFIX", solo_settings.SOLO_CACHE_PREFIX) | |||
return f"{prefix}:{cls.__name__.lower()}" |
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.
Could you add a comment here that explains why we include cls.__module__
?
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.
Please also update CHANGES
. You can add a line under
Unreleased
==========
@ahumeau Thank you for your contribution. |
My pleasure, thanks for your work maintaining this project! |
Two models with the same name in different apps would previously get the same cache key.
Including the model's module in the cache key fixes this.