Question

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.

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top