fix: Hash cache key for default memcached cache (#6089)

This commit is contained in:
Jennifer Richards 2023-08-08 15:21:19 -03:00 committed by GitHub
parent 4653906eec
commit 7e852aebfc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -10,6 +10,7 @@ import os
import sys
import datetime
import warnings
from hashlib import sha384
from typing import Any, Dict, List, Tuple # pyflakes:ignore
warnings.simplefilter("always", DeprecationWarning)
@ -733,6 +734,9 @@ CACHES = {
'LOCATION': '127.0.0.1:11211',
'VERSION': __version__,
'KEY_PREFIX': 'ietf:dt',
'KEY_FUNCTION': lambda key, key_prefix, version: (
f"{key_prefix}:{version}:{sha384(key.encode('utf8')).hexdigest()}"
),
},
'sessions': {
'BACKEND': 'ietf.utils.cache.LenientMemcacheCache',