refactor: Use LRU cache instead of redis cache

This commit is contained in:
Suraj Shetty 2021-10-22 09:29:15 +05:30 committed by GitHub
parent 04374de9eb
commit d88bd035d0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -3,13 +3,11 @@
from __future__ import unicode_literals
import frappe
import functools
@frappe.whitelist()
@functools.lru_cache()
def get_google_fonts():
return frappe.cache().get_value("google_fonts", generator=_get_google_fonts)
def _get_google_fonts():
file_path = frappe.get_app_path("frappe", "data", "google_fonts.json")
return frappe.parse_json(frappe.read_file(file_path))