I have my existing Django web application that uses a MySQLDB without memcaching. I would like to implement memcaching to improve the responsiveness of this site. I see the instructions here.
However, these instructions leave me with some unanswered question(s). Is this all I need to do to get memcache working after I setup the memcached server? Or do I need to alter any of my code outside of settings.py? Does Django nicely handle all the memcaching operations behind the scenes for me whenever models are read or written? (If so, that's very cool!) How can I see what improvement the memcaching is having on the number of DB accesses?
What you've done is just a set up of a Cache Backend.
In order to benefit from caching you need to find the places where it is appropriate and would have a positive impact on performance: your views, templates..you can cache the whole views, templates, template fragments etc.
If you want some automation to help you, take a look at Johnny Cache package:
Or
django-cache-machine
package:There is also an interesting project called
django-cacheops
that is aiming to improve Django ORM caching, but it usesRedis
backend.Also,
django_debug_toolbar
s caching panel can help you in the future.Note that django querysets have a built-in internal cache, but it has nothing to do with a cache framework.
Further reading: