Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions ietf/meeting/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import jsonschema
import os
import requests
from hashlib import sha384

import pytz
import subprocess
Expand Down Expand Up @@ -1026,7 +1025,7 @@ def generate_proceedings_content(meeting, force_refresh=False):
:meeting: meeting whose proceedings should be rendered
:force_refresh: true to force regeneration and cache refresh
"""
cache = caches["default"]
cache = caches["proceedings"]
key_components = [
"proceedings",
str(meeting.number),
Expand Down Expand Up @@ -1061,8 +1060,9 @@ def generate_proceedings_content(meeting, force_refresh=False):
",".join(draft_names),
]

bare_key = ".".join(key_components)
cache_key = sha384(bare_key.encode("utf8")).hexdigest()
# Key is potentially long, but the "proceedings" cache hashes it to a fixed
# length. If that changes, hash it separately here first.
cache_key = ".".join(key_components)
if not force_refresh:
cached_content = cache.get(cache_key, None)
if cached_content is not None:
Expand Down
22 changes: 22 additions & 0 deletions ietf/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -1374,6 +1374,17 @@ def skip_unreadable_post(record):
"LOCATION": f"{MEMCACHED_HOST}:{MEMCACHED_PORT}",
"VERSION": __version__,
"KEY_PREFIX": "ietf:dt",
# Key function is default except with sha384-encoded key
"KEY_FUNCTION": lambda key, key_prefix, version: (
f"{key_prefix}:{version}:{sha384(str(key).encode('utf8')).hexdigest()}"
),
},
"proceedings": {
"BACKEND": "ietf.utils.cache.LenientMemcacheCache",
"LOCATION": f"{MEMCACHED_HOST}:{MEMCACHED_PORT}",
# No release-specific VERSION setting.
"KEY_PREFIX": "ietf:dt:proceedings",
# Key function is default except with sha384-encoded key
"KEY_FUNCTION": lambda key, key_prefix, version: (
f"{key_prefix}:{version}:{sha384(str(key).encode('utf8')).hexdigest()}"
),
Expand Down Expand Up @@ -1421,6 +1432,17 @@ def skip_unreadable_post(record):
"VERSION": __version__,
"KEY_PREFIX": "ietf:dt",
},
"proceedings": {
"BACKEND": "django.core.cache.backends.dummy.DummyCache",
# "BACKEND": "ietf.utils.cache.LenientMemcacheCache",
# "LOCATION": "127.0.0.1:11211",
# No release-specific VERSION setting.
"KEY_PREFIX": "ietf:dt:proceedings",
# Key function is default except with sha384-encoded key
"KEY_FUNCTION": lambda key, key_prefix, version: (
f"{key_prefix}:{version}:{sha384(str(key).encode('utf8')).hexdigest()}"
),
},
"sessions": {
"BACKEND": "django.core.cache.backends.locmem.LocMemCache",
},
Expand Down
Loading