From 3f14fdb51beaf145fce101f9563b599f76b2e3c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Wed, 22 Apr 2015 09:45:25 +0200 Subject: [PATCH] Allow disabling the cache during development Set "devel > cache > enabled" to false in config.yaml to disable the cache. Defaults to true. --- src/octoprint/server/util/flask.py | 5 +++++ src/octoprint/settings.py | 3 +++ 2 files changed, 8 insertions(+) diff --git a/src/octoprint/server/util/flask.py b/src/octoprint/server/util/flask.py index 45317066..fd3174f8 100644 --- a/src/octoprint/server/util/flask.py +++ b/src/octoprint/server/util/flask.py @@ -76,6 +76,11 @@ def cached(timeout=5 * 60, key=lambda: "view/%s" % flask.request.path, unless=No logger.debug("Cache bypassed, calling wrapped function") return f(*args, **kwargs) + # also bypass the cache if it's disabled completely + if not settings().getBoolean(["devel", "cache", "enabled"]): + logger.debug("Cache disabled, calling wrapped function") + return f(*args, **kwargs) + cache_key = key() # only take the value from the cache if we are not required to refresh it from the wrapped function diff --git a/src/octoprint/settings.py b/src/octoprint/settings.py index 7ed93369..27dec306 100644 --- a/src/octoprint/settings.py +++ b/src/octoprint/settings.py @@ -237,6 +237,9 @@ default_settings = { }, "devel": { "stylesheet": "css", + "cache": { + "enabled": True + }, "virtualPrinter": { "enabled": False, "okAfterResend": False,