I have setup caching with memcached for my site. This works well
except from this part of my view. My idea was to store all menu items
in the cache, and apply a filter later on to decide if they belong to
the left or top menu.


        menu = cache.get(menu_cache_key)
        if menu:
                menu_left = menu.filter(menu_left = True)
                menu_top = menu.filter(menu_top = True)

I thought that apply the .filter() on the menu would not cause a query
on the database, but it does. So the menu is retrieved from the cache,
and after that the menu items are retrieved from the database (which
makes the caching useless). I found out about this because changes in
the menu are applied immediately on the webpage.

Is this normal behaviour, and should I make multiple entries into the
cache for the left- and topmenu, or is there a way to get this
working?

Rob

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to