summaryrefslogtreecommitdiff
path: root/odoo/http.py
diff options
context:
space:
mode:
authorqsm-odoo <qsm@odoo.com>2019-09-23 17:07:47 +0000
committerqsm-odoo <qsm@odoo.com>2019-09-25 11:55:30 +0000
commitcf27ff8fd3476fd2b3b4b8736d7476dfbe75cfff (patch)
treef774a576b80a9120723a0d038a80cb30bceb0b53 /odoo/http.py
parent14a50ce62f4da822c2318ed946b8292d9236b489 (diff)
[IMP] http, *: review cache TTL values
* base, web Google now recommends a TTL of one year for static contents. We used to use 1 week in almost every case. This commit increases that value to one year for safe resources, like assets bundles which contain a specific hash in the URL which changes if the bundle is recomputed anyway. Note: this commit refactors the code so that both the one week and one year durations are defined in http.py and used by others apps. Loading the library "locale" file used to be done with 10-hours-cache, this has been increased to 1-week-cache by using the http.py STATIC_CACHE var. closes odoo/odoo#37402 Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Diffstat (limited to 'odoo/http.py')
-rw-r--r--odoo/http.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/odoo/http.py b/odoo/http.py
index 9e0da1768fc..a332baeadb2 100644
--- a/odoo/http.py
+++ b/odoo/http.py
@@ -58,8 +58,11 @@ _logger = logging.getLogger(__name__)
rpc_request = logging.getLogger(__name__ + '.rpc.request')
rpc_response = logging.getLogger(__name__ + '.rpc.response')
-# 1 week cache for statics as advised by Google Page Speed
-STATIC_CACHE = 60 * 60 * 24 * 7
+# One week cache for static content (static files in apps, library files, ...)
+# Safe resources may use what google page speed recommends (1 year)
+# (attachments with unique hash in the URL, ...)
+STATIC_CACHE = 3600 * 24 * 7
+STATIC_CACHE_LONG = 3600 * 24 * 365
# To remove when corrected in Babel
babel.core.LOCALE_ALIASES['nb'] = 'nb_NO'