Commit 6b07f9d5 authored by David Mendez's avatar David Mendez
Browse files

Use suffix from config in cache keys

parent d97b4c08
......@@ -107,7 +107,7 @@ def get_es_doc(index_name, doc_id):
:return: the dict with the response from es corresponding to the document
"""
cache_key = f'document-{doc_id}'
cache_key = f'document-{doc_id}-{RUN_CONFIG.get("cache_key_suffix")}'
app_logging.debug(f'cache_key: {cache_key}')
equivalent_query = {
......
......@@ -34,7 +34,7 @@ def parse_search(search_term, es_indexes, selected_es_index):
:return: the query to send to elasticsearch based on the search term provided
"""
cache_key = f'{search_term}-{es_indexes}-{selected_es_index}'
cache_key = f'{search_term}-{es_indexes}-{selected_es_index}-{RUN_CONFIG.get("cache_key_suffix")}'
app_logging.debug(f'cache_key: {cache_key}')
cache_response = cache.fail_proof_get(key=cache_key)
......
......@@ -37,7 +37,7 @@ class FacetsGroupsConfiguration:
:return: the configuration for the facets group
"""
cache_key = f'facets_config_for_group_{index_name}-{group_name}_4'
cache_key = f'facets_config_for_group_{index_name}-{group_name}-{RUN_CONFIG.get("cache_key_suffix")}'
app_logging.debug(f'cache_key: {cache_key}')
cache_response = cache.fail_proof_get(key=cache_key)
......@@ -101,7 +101,7 @@ class FacetsGroupsConfiguration:
:return: a list of all the configured properties among all the groups
"""
cache_key = f'facets_configured_properties_for_{index_name}'
cache_key = f'facets_configured_properties_for_{index_name}-{RUN_CONFIG.get("cache_key_suffix")}'
app_logging.debug(f'cache_key: {cache_key}')
cache_response = cache.fail_proof_get(key=cache_key)
......
......@@ -65,7 +65,7 @@ class GroupConfiguration:
}
"""
cache_key = f'config_for_group_{index_name}-{group_name}'
cache_key = f'config_for_group_{index_name}-{group_name}-{RUN_CONFIG.get("cache_key_suffix")}'
app_logging.debug(f'cache_key: {cache_key}')
cache_response = cache.fail_proof_get(key=cache_key)
......
......@@ -42,7 +42,7 @@ class PropertyConfiguration:
:param prop_id: full path of the property, such as '_metadata.assay_data.assay_subcellular_fraction'
:return: a dict describing the configuration of a property
"""
cache_key = f'config_for_{index_name}-{prop_id}'
cache_key = f'config_for_{index_name}-{prop_id}-{RUN_CONFIG.get("cache_key_suffix")}'
app_logging.debug(f'cache_key: {cache_key}')
cache_response = cache.fail_proof_get(key=cache_key)
......
......@@ -4,13 +4,14 @@ Module that generates the in vivo assay classification tree
from app import cache
from app import app_logging
from app.visualisation_data.shared.tree_generator import TargetHierarchyTreeGenerator
from app.config import RUN_CONFIG
def get_classification_tree():
"""
:return: the in vivo classificacion tree.
"""
cache_key = 'assay_classifications_in_vivo'
cache_key = f'assay_classifications_in_vivo-{RUN_CONFIG.get("cache_key_suffix")}'
app_logging.debug(f'cache_key: {cache_key}')
cache_response = cache.fail_proof_get(key=cache_key)
......
......@@ -4,6 +4,7 @@ Module that generates the go slim target classification
from app import cache
from app import app_logging
from app.visualisation_data.shared.tree_generator import GoSlimTreeGenerator
from app.config import RUN_CONFIG
def get_classification_tree():
......@@ -11,7 +12,7 @@ def get_classification_tree():
:return: the go slim target classification tree
"""
cache_key = 'target_classifications_go_slim_1'
cache_key = f'target_classifications_go_slim_1-{RUN_CONFIG.get("cache_key_suffix")}'
app_logging.debug(f'cache_key: {cache_key}')
cache_response = cache.fail_proof_get(key=cache_key)
......
......@@ -5,13 +5,14 @@ Module that generates the organism taxonomy target classification
from app import cache
from app import app_logging
from app.visualisation_data.shared.tree_generator import TargetHierarchyTreeGenerator
from app.config import RUN_CONFIG
def get_classification_tree():
"""
:return: the organism taxonomy target classification tree
"""
cache_key = 'target_classifications_organism_taxonomy_1'
cache_key = f'target_classifications_organism_taxonomy_1--{RUN_CONFIG.get("cache_key_suffix")}'
app_logging.debug(f'cache_key: {cache_key}')
cache_response = cache.fail_proof_get(key=cache_key)
......
......@@ -4,13 +4,14 @@ Module that generates the protein target classification
from app import cache
from app import app_logging
from app.visualisation_data.shared.tree_generator import TargetHierarchyTreeGenerator
from app.config import RUN_CONFIG
def get_classification_tree():
"""
:return: the protein target classification tree
"""
cache_key = 'target_classifications_protein_class_1'
cache_key = f'target_classifications_protein_class_1-{RUN_CONFIG.get("cache_key_suffix")}'
app_logging.debug(f'cache_key: {cache_key}')
cache_response = cache.fail_proof_get(key=cache_key)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment