theonion / betty-cropper

A work-in-progress image cropper.
MIT License
27 stars 7 forks source link

Add 304/If-Modified-Since cache refresh support #73

Closed mparent61 closed 8 years ago

mparent61 commented 8 years ago

Major efficiency gain by supporting "If-Modified-Since" request header to avoid hitting storage backend.

This is especially important when using non-disk storage like S3, and eventually disabling on-disk saved crops (served by NGINX).

mparent61 commented 8 years ago

@benghaziboy @MichaelButkovic

Adds 304 support, which is important before we turn off on-disk caching in production (previously 304s were handled by NGINX). Once we disable on-disk caching, this new 304 logic in Django will prevent S3 storage access on cache refreshes.

This logic was a little more complicated than I'd like due to limitations with Python 2.7 and Django < 1.9.

MichaelButkovic commented 8 years ago

LGTM