How to cache Django Rest Framework API calls?

Ok, so, in order to use caching for your queryset: class ProductListAPIView(generics.ListAPIView): def get_queryset(self): return get_myobj() serializer_class = ProductSerializer You’d probably want to set a timeout on the cache set though (like 60 seconds): cache.set(cache_key, result, 60) If you want to cache the whole view: from django.utils.decorators import method_decorator from django.views.decorators.cache import cache_page class ProductListAPIView(generics.ListAPIView): … Read more

Which .NET Memcached client do you use, EnyimMemcached vs. BeITMemcached? [closed]

We tested both and found Enyim to perform the best for our expected usage scenario: many (but not millions) cached objects, and millions of cache-get requests (average web site concurrency load = 16-20 requests.) Our performance factor was measuring the time from making the request to having the object initialized in memory on the calling … Read more

Installing memcached for a django project

Just do pip install python-memcached and you should be good. As for installing memcached itself, it depends on the platform you are on. Windows – http://pureform.wordpress.com/2008/01/10/installing-memcache-on-windows-for-php/ OS X – brew install memcached Debian/Ubuntu – sudo apt-get install memcached On OS X/Linux, just run memcached in the command line.

What’s the memcached server

I agree with most things @phihag has answered but I must clarify some things. Memcached stores data according to a key (phihag called it an id, not to be confused with database ids). Data can be of various sizes so you can store small bits (like 1 record pulled from the database) or you can … Read more

Rails.cache error in Rails 3.1 – TypeError: can’t dump hash with default proc

This might be a little verbose but I had to spend some time with the Rails source code to learn how the caching internals work. Writing things down aids my understanding and I figure that sharing some notes on how things work can’t hurt. Skip to the end if you’re in a hurry. Why It … Read more