mirror of
https://github.com/flibusta-apps/book_library_server.git
synced 2025-12-06 07:05:36 +01:00
Fix cache key generation
This commit is contained in:
@@ -75,7 +75,7 @@ class TRGMSearchService(Generic[T]):
|
|||||||
@classmethod
|
@classmethod
|
||||||
def get_cache_key(cls, query_data: str, allowed_langs: list[str]) -> str:
|
def get_cache_key(cls, query_data: str, allowed_langs: list[str]) -> str:
|
||||||
model_class_name = cls.cache_prefix
|
model_class_name = cls.cache_prefix
|
||||||
allowed_langs_part = ",".join(allowed_langs)
|
allowed_langs_part = ",".join(sorted(allowed_langs))
|
||||||
return f"{model_class_name}_{query_data}_{allowed_langs_part}"
|
return f"{model_class_name}_{query_data}_{allowed_langs_part}"
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@@ -130,7 +130,7 @@ class TRGMSearchService(Generic[T]):
|
|||||||
|
|
||||||
limited_object_ids = object_ids[params.offset : params.offset + params.limit]
|
limited_object_ids = object_ids[params.offset : params.offset + params.limit]
|
||||||
|
|
||||||
queryset: QuerySet[T] = cls.model.objects
|
queryset: QuerySet[T] = cls.model.objects # type: ignore
|
||||||
|
|
||||||
if cls.PREFETCH_RELATED is not None:
|
if cls.PREFETCH_RELATED is not None:
|
||||||
queryset = queryset.prefetch_related(cls.PREFETCH_RELATED)
|
queryset = queryset.prefetch_related(cls.PREFETCH_RELATED)
|
||||||
|
|||||||
Reference in New Issue
Block a user