[cache] website cache by language

This commit is contained in:
Rushabh Mehta 2015-03-10 18:35:20 +05:30
parent cd141af42b
commit 3155aff58b
3 changed files with 4 additions and 4 deletions

View file

@ -11,7 +11,7 @@ from frappe.website.utils import can_cache
def get_context(path):
context = None
cache_key = "page_context:{}".format(path)
cache_key = "page_context:{0}:{1}".format(path, frappe.local.lang)
def add_data_path(context):
if not context.data:

View file

@ -99,7 +99,7 @@ def build_response(path, data, http_status_code, headers=None):
def render_page(path):
"""get page html"""
cache_key = ("page_context:{}" if is_ajax() else "page:{}").format(path)
cache_key = ("page_context:{0}:{1}" if is_ajax() else "page:{0}:{1}").format(path, frappe.local.lang)
out = None
@ -144,7 +144,7 @@ def build_page(path):
html = scrub_relative_urls(html)
if can_cache(context.no_cache):
frappe.cache().set_value("page:" + path, html)
frappe.cache().set_value("page:{0}:{1}".format(path, frappe.local.lang), html)
return html

View file

@ -9,7 +9,7 @@ from frappe.model.document import get_controller
def get_route_info(path):
sitemap_options = None
cache_key = "sitemap_options:{}".format(path)
cache_key = "sitemap_options:{0}:{1}".format(path, frappe.local.lang)
if can_cache():
sitemap_options = frappe.cache().get_value(cache_key)