Question

I've extended sorl-thumbnail's KVStoreBase class, and made a key-value backend that uses a single MongoDB collection. This was done in order to avoid installing a discrete key-value store (e.g. Redis).

Should I clear the collection every once in a while?

What are the downsides?

Was it helpful?

Solution

Only clear the collection if low disk usage is more important to you than fast access times.

The downsides are that your users will all hit un-cached thumbs simultaneously (And simultaneously begin recomputing them).

Just run python manage.py thumbnail cleanup

This cleans up the Key Value Store from stale cache. It removes references to images that do not exist and thumbnail references and their actual files for images that do not exist. It removes thumbnails for unknown images.

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