perf: cache link previews for 10 minutes (#32161)
Often used for masters and often never change
This commit is contained in:
parent
e038da5129
commit
599c3a9b77
2 changed files with 11 additions and 4 deletions
|
|
@ -1,8 +1,10 @@
|
|||
import frappe
|
||||
from frappe.model import no_value_fields, table_fields
|
||||
from frappe.utils.caching import http_cache
|
||||
|
||||
|
||||
@frappe.whitelist()
|
||||
@http_cache(max_age=60 * 10)
|
||||
def get_preview_data(doctype, docname):
|
||||
preview_fields = []
|
||||
meta = frappe.get_meta(doctype)
|
||||
|
|
|
|||
|
|
@ -131,10 +131,15 @@ frappe.ui.LinkPreview = class {
|
|||
}
|
||||
|
||||
get_preview_data() {
|
||||
return frappe.xcall("frappe.desk.link_preview.get_preview_data", {
|
||||
doctype: this.doctype,
|
||||
docname: this.name,
|
||||
});
|
||||
return frappe.xcall(
|
||||
"frappe.desk.link_preview.get_preview_data",
|
||||
{
|
||||
doctype: this.doctype,
|
||||
docname: this.name,
|
||||
},
|
||||
"GET",
|
||||
{ cache: true }
|
||||
);
|
||||
}
|
||||
|
||||
init_preview_popover(preview_data) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue