title: Query only once with Django Rest Framework
body: <p>I'm obtaining data from database and display on table via jQuery and Django Rest Framework(DRF). Also, I'm using pagination. The problem is that every time I click &quot;next&quot; or &quot;previous&quot; button on table, <code>get_queryset()</code> is called and DRF make the query again and again which slows down pagination. How can I save/cache this query result so pagination doesn't query every time I use pagination?</p>
  <h1>DRF Implementation in view</h1>
  <pre><code>class SomeListing(generics.ListAPIView):
      pagination_class = ResultsSetPagination
      serializer_class = ResultSerializer
      
      def get_queryset(self):
          param = self.request.query_params.get('param', None)
  
          query = some_function_to_get_data(self.request, param)
  
          return query
  </code></pre>