From c2150b66f313037ba8db88663860cae44985051d Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Mon, 26 Jun 2023 13:26:28 +0100 Subject: [PATCH] Reduce cache times This means content will be updated faster after changes --- website/contrib/singleton_page/utils.py | 2 +- website/home/models.py | 2 +- website/utils/context_processors.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/website/contrib/singleton_page/utils.py b/website/contrib/singleton_page/utils.py index 18e8479..608c1f1 100644 --- a/website/contrib/singleton_page/utils.py +++ b/website/contrib/singleton_page/utils.py @@ -27,6 +27,6 @@ class SingletonPageCache: url = page.get_url(request) - cache.set(cache_key, url, 86400) + cache.set(cache_key, url, 10800) return url diff --git a/website/home/models.py b/website/home/models.py index a69d781..ce8e680 100644 --- a/website/home/models.py +++ b/website/home/models.py @@ -12,7 +12,7 @@ from website.common.models import BasePage from website.contrib.singleton_page.utils import SingletonPageCache -@django_cache_decorator(time=21600) +@django_cache_decorator(time=600) def get_latest_blog_post() -> Optional[Tuple[str, str]]: from website.blog.models import BlogPostPage diff --git a/website/utils/context_processors.py b/website/utils/context_processors.py index 599f34c..6f6099e 100644 --- a/website/utils/context_processors.py +++ b/website/utils/context_processors.py @@ -4,7 +4,7 @@ from django.http.request import HttpRequest def global_vars(request: HttpRequest) -> dict: # noop caching in preview - fragment_cache_ttl = 0 if getattr(request, "is_preview", False) else 21600 + fragment_cache_ttl = 0 if getattr(request, "is_preview", False) else 3600 return { "SEO_INDEX": settings.SEO_INDEX, "DEBUG": settings.DEBUG,