Upon looking at the source, it looks like I am using an out of date way 
to generate the cache key:

http://code.djangoproject.com/browser/django/trunk/django/utils/cache.py

Does anyone have an example of how to generate the key from just the 
page path? i.e.

/about/

The : get_cache_key API takes a request, but I need to delete the cache 
for a specific page (which isnt the one being requested).

mike

Mike Chambers wrote:
> I am using memcache for my site, and it is working well except for one 
> issue.
> 
> When a user enters a comment, I redirect them to the page they commented 
> from. However, since the page is cached they dont see the comment.
> 
> My first fix was to just appened a query string to the URL, but this 
> then means other people dont see the content until the cache expires.
> 
> So, now I have code that removes the item from the cache before I 
> redirect to the page:
> 
> -- 
> from urlparse import urlparse
> ref_uri = urlparse(request.META['HTTP_REFERER'])
>     
> key = 
> 'views.decorators.cache.cache_page..%s.d41d8cd98f00b204e9800998ecf8427e' 
> % (ref_uri.path)
>     
> from django.core.cache import cache
> cache.set(key, None)
> 
> return HttpResponseRedirect(request.META['HTTP_REFERER'] + "#c_" + 
> str(comment.id))
> -- 
> 
> The key ends up looking like:
> 
> views.decorators.cache.cache_page../about/.d41d8cd98f00b204e9800998ecf8427e
> 
> I got the key code from:
> http://groups.google.com/group/django-users/browse_thread/thread/500d8cebe1f0c4e1/b077ec2e97697601?lnk=gst&q=cache+delete+page#b077ec2e97697601
>  
> 
> 
> Anyways, this doesnt work, and when I am redirected to the page, I am 
> still getting the cached version.
> 
> Does anyone see what I might be doing wrong? Am I removing the page from 
> the cache correctly?
> 
> mike

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to