I am trying to cache query results on my django app. However, it seems that it is caching the whole app. I tried following logi:
def cacheView():
result = cache.get('key')
if result is None:
result = Model.objects.get(id=1)
cache.set('key', 'result')
I am calling this method when user logs in. However, if I try to logout after login, it keeps me on same page as if I am still logged in. I tried to follow the Django documentation on cache at http://docs.djangoproject.com/en/1.2/topics/cache/ but to no success.
Another thing I tried is that if I try to use the cache decorator just above the view as:
@cache_control(max_age=1000)
def cacheView():
...
it does it gives an error saying "response header not defined". I am new to django and sure that I missed something. Any idea?