From c843600d76121b2adfa66ad027489a73f0a70bde Mon Sep 17 00:00:00 2001 From: Sahil Batra Date: Fri, 21 Jul 2023 15:13:44 +0530 Subject: [PATCH] docs: Fix get_user function in caching documentation. This commit fixes the get_user function code to be same as that of the original function in models.py. --- docs/subsystems/caching.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/subsystems/caching.md b/docs/subsystems/caching.md index f0e7475e0f..497ef3dfdc 100644 --- a/docs/subsystems/caching.md +++ b/docs/subsystems/caching.md @@ -68,8 +68,9 @@ def user_profile_cache_key(email: str, realm: "Realm") -> str: @cache_with_key(user_profile_cache_key, timeout=3600 * 24 * 7) def get_user(email: str, realm: Realm) -> UserProfile: - return UserProfile.objects.select_related().get( - email__iexact=email.strip(), realm=realm) + return UserProfile.objects.select_related("realm", "bot_owner").get( + email__iexact=email.strip(), realm=realm + ) ``` This decorator implements a pretty classic caching paradigm: