sorl缩略图和缓存问题

发布于 2024-10-23 11:36:38 字数 322 浏览 1 评论 0原文

你好 当与我的模型关联的图像被修改时,我试图获取 sorl 缩略图以删除缓存的缩略图。我使用如下所示的信号来完成此操作。监听器调用成功,但缓存的缩略图并未被删除,并继续显示旧的缩略图。

def delete_thumbnail(sender, **kwargs):
f = kwargs.get('file_object')
delete(f, delete_file=False)

EditStudentImage.connect(delete_thumbnail, dispatch_uid="edit_student_image")

任何帮助将不胜感激。

Hello
I am trying to get sorl thumbnail to delete cached thumbnails when the image associated with my model is modified. I am accomplishing this using a signal as shown below. The listner is called successfully, yet the cached thumbnail is not being deleted and keeps showing the old thumbnail.

def delete_thumbnail(sender, **kwargs):
f = kwargs.get('file_object')
delete(f, delete_file=False)

EditStudentImage.connect(delete_thumbnail, dispatch_uid="edit_student_image")

Any help would be much appreciated.

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

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

发布评论

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

评论(1

诗化ㄋ丶相逢 2024-10-30 11:36:38

您的缓存可能已过时。如果您使用缓存的数据库键值存储,则可能意味着数据库顶部的缓存已过时,当发生这种情况时(您可能已手动清除数据库表,而不是其缓存),它对您没有帮助像这样使用删除,并且使用缩略图清除管理命令来清除也无济于事。您必须手动清除数据库顶部的缓存。例如,这可能意味着重新启动您的 memcached 守护进程。如果您使用 Redis 键值存储,则不会发生这种情况。

Your cache is probably stale. If you are using the cached db key value store it could mean that the cache on top of the db is stale, when that happends (you might have cleared the database table manually and not the cache for it) it does not help for you to use delete like this, and it wont help to clear using the thumbnail clear management command either. You have to clear the cache that is on top of the database manually. This could mean restarting your memcached daemon for example. If you were using redis key value store this would not happend.

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