diff options
-rw-r--r-- | core/decorators.py | 12 | ||||
-rw-r--r-- | requirements.txt | 2 |
2 files changed, 8 insertions, 6 deletions
diff --git a/core/decorators.py b/core/decorators.py index 4934b60..fece564 100644 --- a/core/decorators.py +++ b/core/decorators.py @@ -16,8 +16,7 @@ def cache_page( timeout can either be the number of seconds or the name of a SystemOptions value. """ - if isinstance(timeout, str): - timeout = Config.lazy_system_value(timeout) + _timeout = timeout def decorator(function): @wraps(function) @@ -26,10 +25,11 @@ def cache_page( if per_identity: identity_id = request.identity.pk if request.identity else "0" prefix = f"{key_prefix or ''}:ident{identity_id}" - _timeout = timeout - if callable(_timeout): - _timeout = _timeout() - return dj_cache_page(timeout=_timeout, key_prefix=prefix)(function)( + if isinstance(_timeout, str): + timeout = getattr(Config.system, _timeout) + else: + timeout = _timeout + return dj_cache_page(timeout=timeout, key_prefix=prefix)(function)( request, *args, **kwargs ) diff --git a/requirements.txt b/requirements.txt index 9f3e3ab..2560fc5 100644 --- a/requirements.txt +++ b/requirements.txt @@ -13,6 +13,8 @@ pillow~=9.3.0 psycopg2~=2.9.5 pydantic~=1.10.2 pyld~=2.0.3 +pylibmc~=1.6.3 +pymemcache~=4.0.0 python-dotenv~=0.21.0 sentry-sdk~=1.11.0 sphinx~=5.3.0 |