Friday, April 26, 2013

Re: Template Caching with Messages

V,

You're exactly correct - make sure you only cache what you actually want cached : ) Anything that should only be visible for one page view isn't a good candidate for caching. If your page has any sort of content that is specific to the current user - login state, etc., you probably don't want to cache that part of the page either, if there's a chance that a user with a different state can hit the same template.

Caching bugs can be subtle. I'd suggest writing some comprehensive integration tests for anything more than the most trivial caching strategies.

Chris


On Wednesday, 24 April 2013 04:02:15 UTC-4, Venkatraman.S. wrote:

It looks to me that when i use a file based caching, and if append messages in my templates(based on user action), that particular page(with message) also gets cached. Since 'these' pages would never be created again, what is the best possible option? (Well, i just used file-based cache to quickly see what was happening, but i guess the same happens for any other cache mode too)

One thing that i could think of is use cache-fragments for the rest of the sections in the template and leave out the 'div' which displays the messages.

Any other solutions or comments?

--
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

No comments:

Post a Comment