Azure Blob Cache
This plugin was added in version 4.2.0.
The Azure blob cache pluging is an extension to the caching mechanism which allows caching of images within AzureBlob Storage to serve via a content delivery network. This is extremely useful for load balanced or high traffic sites where images have to be served outwith the website for increased performance.
The caching mechanism will store processed image files from any allowable image location including but not limited to local, remote, and blob stored locations. The cache is self cleaning and will automatically update itself should a source image change. It is interchangeable with the default disk cache with very little configuration.
Development of this plugin was kindly supported by the amazing team at Crumpled Dog
Make sure you have look at the fine work on their website.
Configuration
Upon installation the following will be added to the Cache.Config section in the configuration files.
<caching currentCache="AzureBlobCache">
<caches>
<!--
Disk cache configuration removed for brevity.
browserMaxDays (Added v1.2.0) separates the time to cache the image in the browser from the time to store
the image in the cache
folderDepth (Optional - Added v1.3.0) sets the maximum number folder levels to nest the cached images. Defaults to 6.
trimCache (Optional - Added v1.3.0) whether to perform a cleanup of the cache when a new file is created. Defaults to true.
memoryMaxMinutes (Optional - Added v1.4.2) how long to store a cached file reference in-memory to reduce IO. Defaults to 1 minute.
-->
<cache name="AzureBlobCache" type="ImageProcessor.Web.Plugins.AzureBlobCache.AzureBlobCache, ImageProcessor.Web.Plugins.AzureBlobCache"
maxDays="365" browserMaxDays="7" folderDepth="6" trimCache="true" memoryMaxMinutes="1">
<settings>
<!-- The Account, Container and CDN details -->
<setting key="CachedStorageAccount" value="DefaultEndpointsProtocol=https;AccountName=[CacheAccountName];AccountKey=[CacheAccountKey]"/>
<setting key="CachedBlobContainer" value="cache"/>
<!-- Whether to add the container name to the CDN url. Newer Azure formats require false. -->
<setting key="UseCachedContainerInUrl" value="true"/>
<!-- Full CDN root url e.g http://123456.vo.msecnd.net/ -->
<setting key="CachedCDNRoot" value="[CdnRootUrl]"/>
<!-- Optional setting for a timeout limit in milliseconds when attempting to communicate with the CDN url. -->
<setting key="CachedCDNTimeout" value="1000"/>
<!--
Optional settings for better identifcation of source images if stored in
Azure blob storage.
-->
<setting key="SourceStorageAccount" value=""/>
<setting key="SourceBlobContainer" value=""/>
<!--
Optional settings facilitate streaming of the blob resource directly instead of a redirect. This is beneficial
for CDN purposes but caution should be taken if not used with a CDN as it will add quite a bit of overhead
to the site.
-->
<setting key="StreamCachedImage" value="false"/>
</settings>
</cache>
</caches>
</caching>