public
Description: k9 is a complete Django based Project for my k9 rescue dog unit. See Wiki for details.
Homepage: http://www.rettungshunde-stralsund.de/
Clone URL: git://github.com/bartTC/k9.git
k9 / middleware.py
100644 13 lines (11 sloc) 0.367 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
from django.utils.cache import get_cache_key
from django.core.cache import cache
 
class CachePurgeMiddleware(object):
    def process_request(self, request):
        if 'purge' in request.session:
            k = get_cache_key(request)
            try:
                cache.delete(k)
            except:
                pass
            del request.session['purge']