From 7ea04216244cff14ac313886c97cc70f0d5d9132 Mon Sep 17 00:00:00 2001 From: Ankush Menat Date: Mon, 6 Jan 2025 19:35:21 +0530 Subject: [PATCH] perf: cache system settings in client side cache --- frappe/__init__.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/frappe/__init__.py b/frappe/__init__.py index 3ee988c15f..245b15f486 100644 --- a/frappe/__init__.py +++ b/frappe/__init__.py @@ -2347,8 +2347,13 @@ def get_website_settings(key): def get_system_settings(key: str): """Return the value associated with the given `key` from System Settings DocType.""" if not (system_settings := getattr(local, "system_settings", None)): + key = get_document_cache_key("System Settings", "System Settings") try: - local.system_settings = system_settings = get_cached_doc("System Settings") + system_settings = client_cache.get_value(key) + if not system_settings: + system_settings = frappe.get_doc("System Settings") + client_cache.set_value(key, system_settings) + local.system_settings = system_settings except DoesNotExistError: # possible during new install clear_last_message() return