diff --git a/backend/src/main.py b/backend/src/main.py index e9638f0..0fcc6ce 100644 --- a/backend/src/main.py +++ b/backend/src/main.py @@ -132,14 +132,6 @@ def get_landmark(landmark_uuid: str) -> Landmark: """ try: landmark = cache_client.get(f"landmark_{landmark_uuid}") - if not isinstance(landmark, Landmark) : - raise HTTPException(status_code=500, detail=f"Object {landmark} is not of type Landmark") return landmark except KeyError as exc: raise HTTPException(status_code=404, detail="Landmark not found") from exc - except ConnectionError as exc: - raise HTTPException(status_code=503, detail="Service unavailable") from exc - except TimeoutError as exc: - raise HTTPException(status_code=504, detail="Request timed out") from exc - except Exception as exc: - raise HTTPException(status_code=500, detail="An unexpected error occurred") from exc diff --git a/backend/src/persistence.py b/backend/src/persistence.py index 97bfaf0..97f9bb7 100644 --- a/backend/src/persistence.py +++ b/backend/src/persistence.py @@ -1,5 +1,5 @@ """Module used for handling cache""" - +from pymemcache import serde from pymemcache.client.base import Client from .constants import MEMCACHED_HOST_PATH @@ -70,5 +70,6 @@ else: MEMCACHED_HOST_PATH, timeout=1, allow_unicode_keys=True, - encoding='utf-8' + encoding='utf-8', + serde=serde.pickle_serde )