From 2033941953af5fbc33b78fb700e1dbc62ad6621b Mon Sep 17 00:00:00 2001
From: Helldragon67 <kilian.scheidecker@orange.fr>
Date: Sat, 14 Dec 2024 13:22:41 +0100
Subject: [PATCH] pymemcache fixture

---
 backend/src/main.py        | 8 --------
 backend/src/persistence.py | 5 +++--
 2 files changed, 3 insertions(+), 10 deletions(-)

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
     )