This project is read-only.
1
Vote

url generation - cache

description

We are using cropup on a site which has a varnish cache in front of it.
When you alter a crop, the URL generated by
@CropUp.GetUrl(imageUrl, new ImageSizeArguments { CropAlias = "banner", Width=1600 })
call doesn't change when you adjust the crop.
This produces something similar to
/CropUp/1600x-banner/media/1030/CriminalMinds.jpg
Normally, the e-tag and modify date would be sufficent but when you are using a high TTL on varnish, you need to notify it to clear the cache via a PURGE.
We can do this if we know in advance the different URLs to purge and then hook the media save event but that requires the varnish purge plugin (which hooks publish) to know in advance which crops and sizes are used via the razor scripts.
A better solution might be that when a cropup URL is generated, a segment is injected into the url which is a checksum/hash of the crop data for the image being generated. Therefore, if you move or resize the crop, the URL changes. This would help defeat caches when changing crops for images in heavily cached sites.
I suggest a URL like the following:
/CropUp/1600x-banner/165ab23cc/media/1030/CriminalMinds.jpg

comments