fix: Cache thrashing in workspace code (#31446) (#31448)

if result is `[]` then it ignores cache and keeps hitting DB for no
reason.

(cherry picked from commit 20b63f3252f9b23655e34ca830cff426ad5a50a3)

Co-authored-by: Ankush Menat <ankush@frappe.io>
This commit is contained in:
mergify[bot] 2025-02-27 08:11:53 +00:00 committed by GitHub
parent 8e273d6701
commit 5d270b9f67
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -86,7 +86,7 @@ class Workspace:
def get_cached(self, cache_key, fallback_fn):
value = frappe.cache.get_value(cache_key, user=frappe.session.user)
if value:
if value is not None:
return value
value = fallback_fn()