0

I am caching in my django template like this.

{% load cache %}
{% cache cache_timeout key_name model_id %}
    <div>          
       {{some_variable}}
    </div>
{% endcache %}

Where cache_timeout is a variable I set in the view with the timeout.

I am also manually changing the cache value using the snippet on the accepted answer to this question

It is working fine as I know the template sets the value with the same key I use. The thing is that when I update the cache (I am checking the updated value and it is the one I set) the template keeps showing the previous value for some time(way smaller than the timeout) before updating.

I need the template to update the value read immediately.

Community
  • 1
  • 1
Lombo
  • 11,847
  • 2
  • 20
  • 27

1 Answers1

1

Check the HTTP headers that are coming back with the response. Sounds like browser caching.

Josh Smeaton
  • 47,939
  • 24
  • 129
  • 164