Skip to content

Commit 7e36b95

Browse files
committed
Remove inconsistent cache which was an attempt to cache using LocMemCache see HEA-651
1 parent 398068d commit 7e36b95

File tree

1 file changed

+0
-12
lines changed

1 file changed

+0
-12
lines changed

apps/baseline/viewsets.py

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import logging
22

33
from django.apps import apps
4-
from django.core.cache import cache
54
from django.db import models
65
from django.db.models import F, OuterRef, Q, Subquery
76
from django.db.models.functions import Coalesce, NullIf
@@ -1876,14 +1875,6 @@ def get(self, request, format=None):
18761875
search_term = request.query_params.get("search", "")
18771876
language = request.query_params.get("language", "en")
18781877

1879-
# Construct a cache key based on search and language parameters
1880-
cache_key = f"filters_{search_term}_{language}".lower()
1881-
cached_results = cache.get(cache_key)
1882-
logger.debug(f"Cached result: {cached_results}")
1883-
if cached_results:
1884-
logger.info(f"Cache hit for key: {cache_key}")
1885-
return Response(cached_results)
1886-
logger.info(f"Cache miss for key: {cache_key}")
18871878
if search_term:
18881879
for model_entry in MODELS_TO_SEARCH:
18891880
app_name = model_entry["app_name"]
@@ -1938,7 +1929,4 @@ def get(self, request, format=None):
19381929
}
19391930
)
19401931

1941-
# Cache results for a week maybe
1942-
cache.set(cache_key, results, timeout=60 * 60 * 24 * 7)
1943-
logger.info(f"Cache set for key: {cache_key}")
19441932
return Response(results)

0 commit comments

Comments
 (0)