From 9ff68a45c522ab58bd5fd38ba350ba7610cc3c6b Mon Sep 17 00:00:00 2001 From: Alex Vandiver Date: Tue, 11 Feb 2025 21:02:14 +0000 Subject: [PATCH] cache_helpers: Switch to storing the by-id user cache, not by-email. The email is not the most commonly used user cache -- the by-id one is. --- zerver/lib/cache_helpers.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/zerver/lib/cache_helpers.py b/zerver/lib/cache_helpers.py index 64792e2803..991ba0a60e 100644 --- a/zerver/lib/cache_helpers.py +++ b/zerver/lib/cache_helpers.py @@ -19,7 +19,7 @@ from zerver.lib.cache import ( get_remote_cache_requests, get_remote_cache_time, user_profile_by_api_key_cache_key, - user_profile_cache_key_id, + user_profile_by_id_cache_key, ) from zerver.lib.safe_session_cached_db import SessionStore from zerver.lib.sessions import session_engine @@ -38,11 +38,7 @@ def user_cache_items( items_for_remote_cache[user_profile_by_api_key_cache_key(user_profile.api_key)] = ( user_profile, ) - items_for_remote_cache[user_profile_cache_key_id(user_profile.email, user_profile.realm_id)] = ( - user_profile, - ) - # We have other user_profile caches, but none of them are on the - # core serving path for lots of requests. + items_for_remote_cache[user_profile_by_id_cache_key(user_profile.id)] = (user_profile,) def client_cache_items(items_for_remote_cache: dict[str, tuple[Client]], client: Client) -> None: