perf: cache system settings in client side cache
This commit is contained in:
parent
c14d416d19
commit
7ea0421624
1 changed files with 6 additions and 1 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue