rahul.m
rahul.m

Reputation: 5854

How to clear browser cache with python django?

I want to clear users browser cache using django.

what i have tried

i have simple function

from django.core.cache import cache 
def clear(request):
    cache.clear()
    return Httpresponse('cleared')

but it won't clears the cache

is there any better option to this

Upvotes: 1

Views: 4730

Answers (1)

user3850
user3850

Reputation:

Browser caches don't work in this way. django.core.cache has nothing to do with the browser cache.

Caching is a very broad and rather complicated topic. You'll have to learn about HTTP headers, tags, different browser behaviour, Proxies, etc., etc. And then you'll find out that you don't want to "clear [the] browser cache" in the first place…

Start here: https://docs.djangoproject.com/en/1.11/topics/cache/#downstream-caches

Upvotes: 4

Related Questions