Trabajando para aprovechar el cache el las relaciones
This commit is contained in:
@@ -4,6 +4,7 @@ import logging
|
||||
import functools
|
||||
|
||||
from django.http import JsonResponse
|
||||
from django.conf import settings
|
||||
|
||||
from pygments import highlight
|
||||
from pygments.lexers import JsonLexer # pylint: disable=no-name-in-module
|
||||
@@ -76,3 +77,11 @@ def sanitize_keys(dictionary):
|
||||
new_key = key.replace('-', '_')
|
||||
replace_key(dictionary, key, new_key)
|
||||
return dictionary
|
||||
|
||||
|
||||
def make_key(key, key_prefix=None, version=1):
|
||||
"""Key generation function for cache"""
|
||||
if key_prefix is None:
|
||||
key_prefix = settings.CACHES.get('default').get('KEY_PREFIX')
|
||||
|
||||
return ':'.join([key_prefix, str(version), key])
|
||||
|
||||
Reference in New Issue
Block a user