I use the ImageResizer tool with the DiskCache plugin. We use Azure blob storage to store images and a custom plugin to serve those images within the resizer code. Something went awry and some of the blobs have been deleted, but are cached in the DiskCache in the resizer.
I need to be able to build the hash key to be able to identify the images in the cache. I tried building the key from what I can see in the code, but the string returned does not yield a file in the cache
var vp = ResolveAppRelativeAssumeAppRelative(virtualPath);
var qs = PathUtils.BuildQueryString(queryString).Replace("&red_dot=true", "");
var blob = new Blob(this, virtualPath, queryString);
var modified = blob.ModifiedDateUTC;
var cachekey = string.Format("{0}{1}|{2}", vp, qs, blob.GetModifiedDateUTCAsync().Result.Ticks.ToString(NumberFormatInfo.InvariantInfo));
var relativePath = new UrlHasher().hash(cachekey, 4096, "/");
How can I query the cache to see if the images are still cached and then delete them if they do not exist in the blob storage account?
Note: I have tried to use the AzureReader2 plugin and it doesn't work for us at the moment.
Custom plugins are responsible for controlling access to cached files.
If you want to see where an active request is being cached, check out HttpContext.Current.Items["FinalCachedFile"]
during the EndRequest phase of the request. You could do this with an event handler.