Skip to content

Commit

Permalink
allow flexible cache config
Browse files Browse the repository at this point in the history
  • Loading branch information
Hakan committed May 13, 2024
1 parent 1315953 commit d2f55b1
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
5 changes: 5 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
4.5
----
* disable/enable cache with enviroment variable CASHES_DISABLED
* allow flexible cache configuration by passing CACHES enviroment variable

4.4
----
* added action point filter
Expand Down
2 changes: 1 addition & 1 deletion src/etools_datamart/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
NAME = "etools-datamart"
VERSION = __version__ = "4.4"
VERSION = __version__ = "4.5"
__author__ = ""
12 changes: 12 additions & 0 deletions src/etools_datamart/config/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
AZURE_STORAGE_ACCESS_MODE=(str, "r"),
AZURE_STORAGE_ACCESS_TTL=(int, 60 * 60 * 24),
AZURE_TENANT=(str, ""),
CACHES_DISABLED=(bool, False),
CACHES=(str, ""),
CACHE_URL=(str, "redis://127.0.0.1:6379/1"),
CACHE_URL_API=(str, "redis://127.0.0.1:6379/2?key_prefix=api"),
CACHE_URL_LOCK=(str, "redis://127.0.0.1:6379/2?key_prefix=lock"),
Expand Down Expand Up @@ -227,6 +229,16 @@
"api": env.cache("CACHE_URL_API"),
}

if env("CACHES_DISABLED"):
CACHES = {
"default": {
"BACKEND": "django.core.cache.backends.dummy.DummyCache",
}
}
elif len(env("CACHES")) > 8:
CACHES = env("CACHES")


ROOT_URLCONF = "etools_datamart.config.urls"

# Python dotted path to the WSGI application used by Django's runserver.
Expand Down

0 comments on commit d2f55b1

Please sign in to comment.