|
1 | 1 | import logging |
2 | 2 |
|
3 | 3 | from django.apps import apps |
4 | | -from django.core.cache import cache |
5 | 4 | from django.db import models |
6 | 5 | from django.db.models import F, OuterRef, Q, Subquery |
7 | 6 | from django.db.models.functions import Coalesce, NullIf |
@@ -1876,14 +1875,6 @@ def get(self, request, format=None): |
1876 | 1875 | search_term = request.query_params.get("search", "") |
1877 | 1876 | language = request.query_params.get("language", "en") |
1878 | 1877 |
|
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}") |
1887 | 1878 | if search_term: |
1888 | 1879 | for model_entry in MODELS_TO_SEARCH: |
1889 | 1880 | app_name = model_entry["app_name"] |
@@ -1938,7 +1929,4 @@ def get(self, request, format=None): |
1938 | 1929 | } |
1939 | 1930 | ) |
1940 | 1931 |
|
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}") |
1944 | 1932 | return Response(results) |
0 commit comments