How to cache Django Rest Framework API calls? : <p>I'm using Memcached as backend to my django app. This code works fine in normal django query:</p>

<pre><code>def get_myobj():
        cache_key = 'mykey'
        result = cache.get(cache_key, None)
        if not result:
            result = Product.objects.all().filter(draft=False)
            cache.set(cache_key, result)
        return result
</code></pre>

<p>But it doesn't work when used with django-rest-framework api calls:</p>

<pre><code>class ProductListAPIView(generics.ListAPIView):
    def get_queryset(self):
        product_list = Product.objects.all()
        return product_list
    serializer_class = ProductSerializer
</code></pre>

<p>I'm about to try DRF-extensions which provide caching functionality:</p>

<p><a href="https://github.com/chibisov/drf-extensions" rel="noreferrer">https://github.com/chibisov/drf-extensions</a></p>

<p>but the build status on github is currently saying "build failing".</p>

<p>My app is very read-heavy on api calls. Is there a way to cache these calls?</p>

<p>Thank you.</p>
