From 0024c2aae49b10f3d121db031d621ce8bf2c8ee2 Mon Sep 17 00:00:00 2001 From: jonaswinkler Date: Sat, 6 Feb 2021 20:51:04 +0100 Subject: [PATCH] caching --- Pipfile | 1 + Pipfile.lock | 11 ++++++++++- src/paperless/settings.py | 12 +++++++++++- 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/Pipfile b/Pipfile index 504b267c4..7fcf3de26 100644 --- a/Pipfile +++ b/Pipfile @@ -51,6 +51,7 @@ channels = "~=3.0" channels-redis = "*" uvicorn = {extras = ["standard"], version = "*"} concurrent-log-handler = "*" +django-redis = "*" [dev-packages] coveralls = "*" diff --git a/Pipfile.lock b/Pipfile.lock index fafec4310..c3d57fc7d 100644 --- a/Pipfile.lock +++ b/Pipfile.lock @@ -1,7 +1,7 @@ { "_meta": { "hash": { - "sha256": "aec5aa96fc4cad6d06f00d0ada0f8bd193f42874f476d39e76fc69d05c78f9f6" + "sha256": "0c2003b9d3d95d1af594f749a2740b55079551ea0ae512177ee9524bb327281e" }, "pipfile-spec": 6, "requires": {}, @@ -273,6 +273,15 @@ "index": "pypi", "version": "==1.3.4" }, + "django-redis": { + "hashes": [ + "sha256:1133b26b75baa3664164c3f44b9d5d133d1b8de45d94d79f38d1adc5b1d502e5", + "sha256:306589c7021e6468b2656edc89f62b8ba67e8d5a1c8877e2688042263daa7a63", + "sha256:f2b25b62cc95b63b7059aaf8e81710e7eea94678e545d31c46e47a6f4af99e56" + ], + "index": "pypi", + "version": "==4.12.1" + }, "djangorestframework": { "hashes": [ "sha256:0209bafcb7b5010fdfec784034f059d512256424de2a0f084cb82b096d6dd6a7", diff --git a/src/paperless/settings.py b/src/paperless/settings.py index 718738f71..60e7b45bd 100644 --- a/src/paperless/settings.py +++ b/src/paperless/settings.py @@ -169,6 +169,16 @@ CHANNEL_LAYERS = { }, } +CACHES = { + "default": { + "BACKEND": "django_redis.cache.RedisCache", + "LOCATION": os.getenv("PAPERLESS_REDIS", "redis://localhost:6379"), + "OPTIONS": { + "CLIENT_CLASS": "django_redis.client.DefaultClient", + } + } +} + ############################################################################### # Security # ############################################################################### @@ -398,7 +408,7 @@ Q_CLUSTER = { 'name': 'paperless', 'catch_up': False, 'workers': TASK_WORKERS, - 'redis': os.getenv("PAPERLESS_REDIS", "redis://localhost:6379") + 'django_redis': 'default' }