prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Cache GET /safe-apps/ endpoint
  The endpoint `GET /safe-apps` returns a list of safe-apps that can be cached (eg.: 1h) due to the nature of the endpoint (frequency of updating the app list is low). Updating the list should invalidate the cache.
  
  </issue>
  <code>
  [start of src/safe_apps/views.py]
  1 from rest_framework.generics import ListAPIView
  2 
  3 from .models import SafeApp
  4 from .serializers import SafeAppsResponseSerializer
  5 
  6 
  7 class SafeAppsListView(ListAPIView):
  8     serializer_class = SafeAppsResponseSerializer
  9 
  10     def get_queryset(self):
  11         queryset = SafeApp.objects.all()
  12 
  13         network_id = self.request.query_params.get("network_id")
  14         if network_id is not None and network_id.isdigit():
  15             queryset = queryset.filter(networks__contains=[network_id])
  16 
  17         return queryset
  18
  [end of src/safe_apps/views.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/src/safe_apps/views.py b/src/safe_apps/views.py
  --- a/src/safe_apps/views.py
  +++ b/src/safe_apps/views.py
  @@ -1,3 +1,5 @@
  +from django.utils.decorators import method_decorator
  +from django.views.decorators.cache import cache_page
   from rest_framework.generics import ListAPIView
   
   from .models import SafeApp
  @@ -7,6 +9,10 @@
   class SafeAppsListView(ListAPIView):
       serializer_class = SafeAppsResponseSerializer
   
  +    @method_decorator(cache_page(60 * 10))  # Cache 10 minutes
  +    def get(self, request, *args, **kwargs):
  +        return super().get(self, request, *args, **kwargs)
  +
       def get_queryset(self):
           queryset = SafeApp.objects.all()
  
verification_info: {"golden_diff": "diff --git a/src/safe_apps/views.py b/src/safe_apps/views.py\n--- a/src/safe_apps/views.py\n+++ b/src/safe_apps/views.py\n@@ -1,3 +1,5 @@\n+from django.utils.decorators import method_decorator\n+from django.views.decorators.cache import cache_page\n from rest_framework.generics import ListAPIView\n \n from .models import SafeApp\n@@ -7,6 +9,10 @@\n class SafeAppsListView(ListAPIView):\n     serializer_class = SafeAppsResponseSerializer\n \n+    @method_decorator(cache_page(60 * 10))  # Cache 10 minutes\n+    def get(self, request, *args, **kwargs):\n+        return super().get(self, request, *args, **kwargs)\n+\n     def get_queryset(self):\n         queryset = SafeApp.objects.all()\n", "issue": "Cache GET /safe-apps/ endpoint\nThe endpoint `GET /safe-apps` returns a list of safe-apps that can be cached (eg.: 1h) due to the nature of the endpoint (frequency of updating the app list is low). Updating the list should invalidate the cache.\n", "before_files": [{"content": "from rest_framework.generics import ListAPIView\n\nfrom .models import SafeApp\nfrom .serializers import SafeAppsResponseSerializer\n\n\nclass SafeAppsListView(ListAPIView):\n    serializer_class = SafeAppsResponseSerializer\n\n    def get_queryset(self):\n        queryset = SafeApp.objects.all()\n\n        network_id = self.request.query_params.get(\"network_id\")\n        if network_id is not None and network_id.isdigit():\n            queryset = queryset.filter(networks__contains=[network_id])\n\n        return queryset\n", "path": "src/safe_apps/views.py"}]}