summaryrefslogtreecommitdiffstats
path: root/users/views/admin
diff options
context:
space:
mode:
authorMichael Manfre2022-12-05 12:55:30 -0500
committerGitHub2022-12-05 10:55:30 -0700
commitd6eb16a398a8d3a2f58399fd40df7f212680cab0 (patch)
tree5561d7c7d33850672e300ba4320ece1e588dbb1b /users/views/admin
parenta9bb4a7122df6d9d4a764de52244c6ec75789ead (diff)
downloadtakahe-d6eb16a398a8d3a2f58399fd40df7f212680cab0.tar.gz
takahe-d6eb16a398a8d3a2f58399fd40df7f212680cab0.tar.bz2
takahe-d6eb16a398a8d3a2f58399fd40df7f212680cab0.zip
Added caching and initial settings
Diffstat (limited to 'users/views/admin')
-rw-r--r--users/views/admin/__init__.py2
-rw-r--r--users/views/admin/settings.py49
2 files changed, 50 insertions, 1 deletions
diff --git a/users/views/admin/__init__.py b/users/views/admin/__init__.py
index 101ca30..04e1195 100644
--- a/users/views/admin/__init__.py
+++ b/users/views/admin/__init__.py
@@ -17,7 +17,7 @@ from users.views.admin.hashtags import ( # noqa
HashtagEdit,
Hashtags,
)
-from users.views.admin.settings import BasicSettings # noqa
+from users.views.admin.settings import BasicSettings, TuningSettings # noqa
@method_decorator(admin_required, name="dispatch")
diff --git a/users/views/admin/settings.py b/users/views/admin/settings.py
index a9ec78b..dc56693 100644
--- a/users/views/admin/settings.py
+++ b/users/views/admin/settings.py
@@ -1,4 +1,5 @@
from django.utils.decorators import method_decorator
+from django.utils.safestring import mark_safe
from core.models import Config
from users.decorators import admin_required
@@ -106,3 +107,51 @@ class BasicSettings(AdminSettingsPage):
"restricted_usernames",
],
}
+
+
+cache_field_defaults = {
+ "min_value": 0,
+ "max_value": 900,
+ "step_size": 15,
+}
+
+
+class TuningSettings(AdminSettingsPage):
+
+ section = "tuning"
+
+ options = {
+ "cache_timeout_page_default": {
+ **cache_field_defaults,
+ "title": "Default Timeout",
+ "help_text": "The number of seconds to cache a rendered page",
+ },
+ "cache_timeout_page_timeline": {
+ **cache_field_defaults,
+ "title": "Timeline Timeout",
+ "help_text": "The number of seconds to cache a rendered timeline page",
+ },
+ "cache_timeout_page_post": {
+ **cache_field_defaults,
+ "title": "Individual Post Timeout",
+ "help_text": mark_safe(
+ "The number of seconds to cache a rendered individual Post page<br>Note: This includes the JSON responses to other servers"
+ ),
+ },
+ "cache_timeout_identity_feed": {
+ **cache_field_defaults,
+ "title": "Identity Feed Timeout",
+ "help_text": "The number of seconds to cache a rendered Identity RSS feed",
+ },
+ }
+
+ layout = {
+ "Rendered Page Cache": [
+ "cache_timeout_page_default",
+ "cache_timeout_page_timeline",
+ "cache_timeout_page_post",
+ ],
+ "RSS Feeds": [
+ "cache_timeout_identity_feed",
+ ],
+ }