prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN 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.
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `src/safe_apps/views.py`
  Content:
  ```
  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 FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
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"}], "after_files": [{"content": "from django.utils.decorators import method_decorator\nfrom django.views.decorators.cache import cache_page\nfrom 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    @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\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"}]}