sorl缩略图和缓存问题
你好 当与我的模型关联的图像被修改时,我试图获取 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您的缓存可能已过时。如果您使用缓存的数据库键值存储,则可能意味着数据库顶部的缓存已过时,当发生这种情况时(您可能已手动清除数据库表,而不是其缓存),它对您没有帮助像这样使用删除,并且使用缩略图清除管理命令来清除也无济于事。您必须手动清除数据库顶部的缓存。例如,这可能意味着重新启动您的 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.