Django - 持久缓存

发布于 2024-10-16 21:11:06 字数 69 浏览 12 评论 0原文

有没有办法可以使用默认的 django 缓存框架无限期地设置缓存键?我尝试将超时设置为 0,但不幸的是,这根本没有设置密钥。

Is there a way I can set a cache key indefinitely using the default django cache framework? I tried setting the timeout to 0, but that doesn't set the key at all unfortunately.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

恰似旧人归 2024-10-23 21:11:06

Django 1.6 现在接受 None 作为超时参数来指定永远。

https://docs.djangoproject.com/en/dev/topics/缓存/#basic-usage

Django 1.6 now accepts None for the timeout argument to specify forever.

https://docs.djangoproject.com/en/dev/topics/cache/#basic-usage

尸血腥色 2024-10-23 21:11:06

最近有人在一个不相关的答案中提到了 Johnny Cache 。当提供 0 超时时,它提供无限缓存 locmemmemcached 后端。

Someone recently mentioned Johnny Cache in an unrelated answer. It provides a infinite caching locmem and memcached backend when a timeout of 0 is provided.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文