Revert "fix: drop Meta cache during update" (#18186)

* Revert "fix: drop Meta cache during update (#18182)"

This reverts commit 656f6df257.

* fix: replace meta cache keys

Old keys stored different types of data `dict` changing key to indicate
change in type.
This commit is contained in:
Ankush Menat 2022-09-19 21:28:45 +05:30 committed by GitHub
parent 656f6df257
commit 2b6fc68088
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 7 additions and 15 deletions

View file

@ -58,8 +58,8 @@ user_cache_keys = (
)
doctype_cache_keys = (
"meta",
"form_meta",
"doctype_meta",
"doctype_form_meta",
"table_columns",
"last_modified",
"linked_doctypes",

View file

@ -35,10 +35,10 @@ ASSET_KEYS = (
def get_meta(doctype, cached=True):
# don't cache for developer mode as js files, templates may be edited
if cached and not frappe.conf.developer_mode:
meta = frappe.cache().hget("form_meta", doctype)
meta = frappe.cache().hget("doctype_form_meta", doctype)
if not meta:
meta = FormMeta(doctype)
frappe.cache().hset("form_meta", doctype, meta)
frappe.cache().hset("doctype_form_meta", doctype, meta)
else:
meta = FormMeta(doctype)

View file

@ -56,14 +56,14 @@ DEFAULT_FIELD_LABELS = {
def get_meta(doctype, cached=True) -> "Meta":
if not cached or frappe.flags.in_patch:
if not cached:
return Meta(doctype)
if meta := frappe.cache().hget("meta", doctype):
if meta := frappe.cache().hget("doctype_meta", doctype):
return meta
meta = Meta(doctype)
frappe.cache().hset("meta", doctype, meta)
frappe.cache().hset("doctype_meta", doctype, meta)
return meta

View file

@ -211,6 +211,5 @@ frappe.patches.v14_0.set_suspend_email_queue_default
frappe.patches.v14_0.different_encryption_key
frappe.patches.v14_0.update_multistep_webforms
execute:frappe.delete_doc('Page', 'background_jobs', ignore_missing=True, force=True)
frappe.patches.v14_0.drop_meta_cache
frappe.patches.v14_0.drop_unused_indexes
frappe.patches.v15_0.drop_modified_index

View file

@ -1,7 +0,0 @@
import frappe
def execute():
cache = frappe.cache()
for key in cache.hkeys("meta"):
cache.hdel("meta", key)