django-avatar
django-avatar copied to clipboard
Add cached sizes key to cache, to ensure that invalidate_cache works correctly
Fixes issue #172
Coverage increased (+0.1%) to 85.531% when pulling 0e66ae5de79f592bee691e84a95cfe4f8fc2dd1c on rafiqhilali:fix-cached-image-sizes into 182e7aa641c70dae1eed3ae2ff1e7d057ec6103f on grantmcconnaughey:master.
Coverage increased (+0.1%) to 85.531% when pulling 0e66ae5de79f592bee691e84a95cfe4f8fc2dd1c on rafiqhilali:fix-cached-image-sizes into 182e7aa641c70dae1eed3ae2ff1e7d057ec6103f on grantmcconnaughey:master.
Coverage increased (+0.1%) to 85.531% when pulling 0e66ae5de79f592bee691e84a95cfe4f8fc2dd1c on rafiqhilali:fix-cached-image-sizes into 182e7aa641c70dae1eed3ae2ff1e7d057ec6103f on grantmcconnaughey:master.
It is now likely to do two two look ups and it also introduces another problem by not distinguishing different sizes. I think the original code had a flawed approach in using 'prefix'. I think it would be better to ditch 'prefix' in cache key and limit the caching to just avatar URLs. Currently when using rebuild_avatars command, the cached_funcs in avatar/utils.py is going to be an empty set and no cache is going to get deleted. I can introduce a PR, but it is going to break current implementation.
Hey @johnyoonh, if you (or someone else) could write a PR for that, I can get it merged fairly quickly.
Hey @rafiqhilali - any comment on @johnyoonh's comment here? I'd like to get something merged that (almost) everyone can agree on.