【发布时间】:2019-06-12 11:10:12
【问题描述】:
我需要使用参数作为前缀来存储模板缓存。
Es。 与:
{% cache 5 :name:variable1: variable_y variable_z %}
<p> {{variable1}} </p>
{% endcache %}
其中 variable1 是一个字符串
我需要存储:
:1:template.cache:name:"variable1 value":.0ecadd093a225ba502d3f6490e19b4
其实我得到:
:1:template.cache:name:variable1:.0ecadd093a225ba502d3f6490e19b4
其中 variable1 是变量名。
有办法吗? 谢谢
【问题讨论】:
-
您可以从视图中传递准备使用的密钥。
-
我从视图中传递变量 1,它是一个字符串。我想在redis键中写入字符串值,但实际上我获得了变量名(“variable1”)
标签: django django-templates django-cache