Tuesday, December 1, 2015

Re: Clear view cache using @cache_page

Thanks for your reply Tim. 

I have tried the code provided, but it seems that the cache is not deleted. 

I am testing the code in development, which uses django.core.cache.backends.locmem.LocMemCache. I don't know if that makes any difference. 

Also, I have noticed that the path in url.path used in request = rf.get(url.path, secure=is_secure) is not an absolute path containing the host name. While searching around, some posts suggested that the path needs to include also the host name for django 1.7+. But doing that didn't change anything. 

I tried using cache.has_key(cache_key) just before calling the delete to check if a key exists, which returns False. 


--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/9d32eecc-d3ec-40e2-935b-497a11a0ac7a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment