From b3bfaf0586cbf436bbbe6ba4b9d118c2c3c8836d Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Thu, 6 Jan 2022 10:27:12 -0800 Subject: [PATCH] Use 6 month cache for items that don't really need to expire --- bookwyrm/templates/feed/suggested_books.html | 3 ++- bookwyrm/templates/snippets/book_titleby.html | 4 +++- bookwyrm/templates/snippets/follow_button.html | 3 ++- bookwyrm/templates/snippets/shelve_button/shelve_button.html | 3 ++- 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/bookwyrm/templates/feed/suggested_books.html b/bookwyrm/templates/feed/suggested_books.html index d559c6caa..b2f1b5d28 100644 --- a/bookwyrm/templates/feed/suggested_books.html +++ b/bookwyrm/templates/feed/suggested_books.html @@ -2,7 +2,8 @@ {% load cache %} {% load bookwyrm_tags %} -{% cache None suggested_books request.user.id %} +{# 6 month cache #} +{% cache 15552000 suggested_books request.user.id %} {% suggested_books as suggested_books %}

{% trans "Your Books" %}

diff --git a/bookwyrm/templates/snippets/book_titleby.html b/bookwyrm/templates/snippets/book_titleby.html index d8e3af994..5e35e36a7 100644 --- a/bookwyrm/templates/snippets/book_titleby.html +++ b/bookwyrm/templates/snippets/book_titleby.html @@ -2,7 +2,9 @@ {% load utilities %} {% load cache %} {% spaceless %} -{% cache None titleby book.id %} + +{# 6 month cache #} +{% cache 15552000 titleby book.id %} {% if book.authors.exists %} {% blocktrans trimmed with path=book.local_path title=book|book_title %} diff --git a/bookwyrm/templates/snippets/follow_button.html b/bookwyrm/templates/snippets/follow_button.html index 4e4793bee..a5c40b24b 100644 --- a/bookwyrm/templates/snippets/follow_button.html +++ b/bookwyrm/templates/snippets/follow_button.html @@ -1,7 +1,8 @@ {% load i18n %} {% load cache %} -{% cache None follow_button request.user.id user.id %} +{# 6 month cache #} +{% cache 15552000 follow_button request.user.id user.id %} {% if request.user == user or not request.user.is_authenticated %} {% elif user in request.user.blocks.all %} {% include 'snippets/block_button.html' with blocks=True %} diff --git a/bookwyrm/templates/snippets/shelve_button/shelve_button.html b/bookwyrm/templates/snippets/shelve_button/shelve_button.html index 4d4d07877..0ffc708d3 100644 --- a/bookwyrm/templates/snippets/shelve_button/shelve_button.html +++ b/bookwyrm/templates/snippets/shelve_button/shelve_button.html @@ -3,7 +3,8 @@ {% load cache %} {% if request.user.is_authenticated %} -{% cache None shelve_button request.user.id book.id %} +{# 6 month cache #} +{% cache 15552000 shelve_button request.user.id book.id %} {% with book.id|uuid as uuid %} {% active_shelf book as active_shelf %}