From da02334a35a0183d624773091089c6433bda34d2 Mon Sep 17 00:00:00 2001 From: Brandon Parker Date: Mon, 29 Jan 2024 12:06:16 -0800 Subject: [PATCH] Update Caching Documentation. (#357) * update caching documentation * fix typo * Update README.md * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: Brandon Parker Co-authored-by: Fabio Caccamo Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- README.md | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index f6b0b7b..bed18e8 100644 --- a/README.md +++ b/README.md @@ -66,7 +66,8 @@ SILENCED_SYSTEM_CHECKS = ["security.W019"] - Run `python manage.py collectstatic --clear` - Restart your application server -> **Warning** - if you want use modals instead of popup windows, ensure to add `X_FRAME_OPTIONS = "SAMEORIGIN"` setting. +> [!WARNING] +> if you want use modals instead of popup windows, ensure to add `X_FRAME_OPTIONS = "SAMEORIGIN"` setting. ### Optional features To make a fieldset start expanded with a `Hide` button to collapse, add the class `"expanded"` to its classes: @@ -183,6 +184,25 @@ At the moment, this package has been translated into the following languages: `d If you do some changes to the project, remember to update translations, because if the translations files are not up-to-date, the `lint` step in the CI will fail: - Run `tox -e translations` +## Caching + +This package uses caching to improve theme load time and overall performance. +You can customise the app caching options using `settings.CACHES["admin_interface"]` setting, otherwise the `"default"` cache will be used: + +```python +CACHES = { + # ... + "admin_interface": { + "BACKEND": "django.core.cache.backends.locmem.LocMemCache", + "TIMEOUT": 60 * 5, + }, + # ... +} +``` + +> [!WARNING] +> There is a [known compatibility issue](https://github.com/fabiocaccamo/django-admin-interface/issues/356) when using this package with `django-redis`, more specifically, using the `JSONSerializer` the following error is raised: `TypeError: Object of type Theme is not JSON serializable`, to mitigate this problem, simply use a specific cache for this app that does not use any `json` serializer. + ## FAQ ### Custom `base-site.html`