From 2d2a7c21081c9086e316d9fb586859cfff43fda6 Mon Sep 17 00:00:00 2001 From: Bruce Martin Date: Fri, 10 Apr 2020 13:58:09 -0600 Subject: [PATCH] bump cache control max_age to one week (#1380) --- server/app/app.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/server/app/app.py b/server/app/app.py index 780ad6a1..d973c9ca 100644 --- a/server/app/app.py +++ b/server/app/app.py @@ -19,6 +19,8 @@ from functools import wraps webbp = Blueprint("webapp", "server.common.web", template_folder="templates") +ONE_WEEK = 7 * 24 * 60 * 60 + def _cache_control(always, **cache_kwargs): """ @@ -52,7 +54,7 @@ def cache_control_always(**cache_kwargs): @webbp.route("/", methods=["GET"]) -@cache_control(public=True, max_age=3600) +@cache_control(public=True, max_age=ONE_WEEK) def dataset_index(dataset=None): config = current_app.app_config if dataset is None: @@ -158,21 +160,21 @@ def dataroot_index(): class SchemaAPI(Resource): - @cache_control(public=True, max_age=3600) + @cache_control(public=True, max_age=ONE_WEEK) @rest_get_data_adaptor def get(self, data_adaptor): return common_rest.schema_get(data_adaptor, current_app.annotations) class ConfigAPI(Resource): - @cache_control(public=True, max_age=3600) + @cache_control(public=True, max_age=ONE_WEEK) @rest_get_data_adaptor def get(self, data_adaptor): return common_rest.config_get(current_app.app_config, data_adaptor, current_app.annotations) class AnnotationsObsAPI(Resource): - @cache_control(public=True, max_age=3600) + @cache_control(public=True, max_age=ONE_WEEK) @rest_get_data_adaptor def get(self, data_adaptor): return common_rest.annotations_obs_get(request, data_adaptor, current_app.annotations) @@ -184,7 +186,7 @@ class AnnotationsObsAPI(Resource): class AnnotationsVarAPI(Resource): - @cache_control(public=True, max_age=3600) + @cache_control(public=True, max_age=ONE_WEEK) @rest_get_data_adaptor def get(self, data_adaptor): return common_rest.annotations_var_get(request, data_adaptor, current_app.annotations) @@ -205,7 +207,7 @@ class DiffExpObsAPI(Resource): class LayoutObsAPI(Resource): - @cache_control(public=True, max_age=3600) + @cache_control(public=True, max_age=ONE_WEEK) @rest_get_data_adaptor def get(self, data_adaptor): return common_rest.layout_obs_get(request, data_adaptor)