django-avatar icon indicating copy to clipboard operation
django-avatar copied to clipboard

Add cached sizes key to cache, to ensure that invalidate_cache works correctly

Open rafiqhilali opened this issue 6 years ago • 5 comments

Fixes issue #172

rafiqhilali avatar Feb 07 '19 16:02 rafiqhilali

Coverage Status

Coverage increased (+0.1%) to 85.531% when pulling 0e66ae5de79f592bee691e84a95cfe4f8fc2dd1c on rafiqhilali:fix-cached-image-sizes into 182e7aa641c70dae1eed3ae2ff1e7d057ec6103f on grantmcconnaughey:master.

coveralls avatar Feb 08 '19 10:02 coveralls

Coverage Status

Coverage increased (+0.1%) to 85.531% when pulling 0e66ae5de79f592bee691e84a95cfe4f8fc2dd1c on rafiqhilali:fix-cached-image-sizes into 182e7aa641c70dae1eed3ae2ff1e7d057ec6103f on grantmcconnaughey:master.

coveralls avatar Feb 08 '19 10:02 coveralls

Coverage Status

Coverage increased (+0.1%) to 85.531% when pulling 0e66ae5de79f592bee691e84a95cfe4f8fc2dd1c on rafiqhilali:fix-cached-image-sizes into 182e7aa641c70dae1eed3ae2ff1e7d057ec6103f on grantmcconnaughey:master.

coveralls avatar Feb 08 '19 10:02 coveralls

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.

johnyoonh avatar Feb 23 '19 23:02 johnyoonh

Hey @johnyoonh, if you (or someone else) could write a PR for that, I can get it merged fairly quickly.

johanneswilm avatar Aug 10 '22 15:08 johanneswilm

Hey @rafiqhilali - any comment on @johnyoonh's comment here? I'd like to get something merged that (almost) everyone can agree on.

johanneswilm avatar Aug 14 '22 10:08 johanneswilm