django, nginx, memcached - the dynamic trio
by oliver | September 12, 2008 | In Django, Python, Web Development, nginx | 1 Comment
Inspired by this article I decided to find out if the same technique can be exploited in my current project which is developed in django.
My first problem was to come up with a viable cache key scheme since simply using the full request URI as suggested in the article wouldn’t work for me because my site renders a different version of a navigation menu depending on the authentication state of current the user. After weighing in the advantages and disadvantages between the super clean variant of factoring the session cookie and all other cookies into the memcached key and a less heavy weight method that would only append a server supplied abstract “page version” field to the request URI, I went for the latter. My resulting nginx virtual host config was looking like this: