开发者

Django template reading wrong cache value

开发者 https://www.devze.com 2023-01-27 21:10 出处:网络
I am caching in my django template like this. {% load cache %} {% cache cache_timeout key_name model_id %}

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 fin开发者_JAVA技巧e 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.


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

0

精彩评论

暂无评论...
验证码 换一张
取 消