Monday, November 29, 2010

Re: Caching middleware causes default page caching

On Sat, Nov 27, 2010 at 4:30 AM, ydjango <traderashish@gmail.com> wrote:
> I have added following to cache some common DB data and it seems it
> has started caching whole pages by default. Some pages appeared to be
> retrieved from cache without even hitting the view.
>....
> and in my views,
>
> from django.core.cache import cache
>  and cache.set('add_key', 'Initial value')
>>>> cache.add('add_key', 'New value')
>>>> cache.get('add_key')
> 'Initial value'
>

It's unclear, but are you querying this behaviour? This is correct
behaviour, cache.add(key, value) will only update the cache if the key
is not already set.

Cheers

Tom

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

No comments:

Post a Comment