Use locale name in request cache key
authorThierry Florac <thierry.florac@onf.fr>
Thu, 19 Jul 2018 16:46:15 +0200
changeset 865 bddcf038737f
parent 864 209432f09f9f
child 866 62633f571e53
Use locale name in request cache key
src/pyams_content/features/footer/skin/__init__.py
src/pyams_content/features/header/skin/__init__.py
--- a/src/pyams_content/features/footer/skin/__init__.py	Thu Jul 19 16:15:30 2018 +0200
+++ b/src/pyams_content/features/footer/skin/__init__.py	Thu Jul 19 16:46:15 2018 +0200
@@ -63,7 +63,8 @@
         else:
             portlets_cache = get_cache(PORTLETS_CACHE_REGION, PORTLETS_CACHE_NAME)
             cache_key = PORTLETS_CACHE_KEY.format(portlet=self.name,
-                                                  context=ICacheKeyValue(self.settings_target))
+                                                  context=ICacheKeyValue(self.settings_target),
+                                                  lang=self.request.locale_name)
             if self.context is not self.request.context:  # display shared content
                 cache_key = '{0}::shared'.format(cache_key)
             try:
--- a/src/pyams_content/features/header/skin/__init__.py	Thu Jul 19 16:15:30 2018 +0200
+++ b/src/pyams_content/features/header/skin/__init__.py	Thu Jul 19 16:46:15 2018 +0200
@@ -69,7 +69,8 @@
         else:
             portlets_cache = get_cache(PORTLETS_CACHE_REGION, PORTLETS_CACHE_NAME)
             cache_key = PORTLETS_CACHE_KEY.format(portlet=self.name,
-                                                  context=ICacheKeyValue(self.settings_target))
+                                                  context=ICacheKeyValue(self.settings_target),
+                                                  lang=self.request.locale_name)
             if self.context is not self.request.context:  # display shared content
                 cache_key = '{0}::shared'.format(cache_key)
             try: