ImageResizer.NET: How to delete cache associated with filename using DiskCache in conjunction with VirtualImageProvider plugin?

StackOverflow https://stackoverflow.com/questions/22388671

  •  14-06-2023
  •  | 
  •  

Question

Is it possible to trigger cache dropping for concrete file in ImageResizer.NET (using DiskCache plugin)?

In my project we need an ability to crop images and then save them with the same file name to preserve integrity, and if I do that, despite of changed modification time (and even created time), Imageresizer returns the old file, that stored in cache dir

Images update only if I manually delete the cache folder

hashModifiedDate property set to true in web config, and I've tried to drop cache folder after changing it, but it doesn't help.

I use custom virtual provider plugin and think that cache problem is related to it, but don't know how exactly (cache works well with images retrieved by direct link, that served without mine virtual path provider )

Was it helpful?

Solution

Yes, you need create plugin which will implement IVirtualFileWithModifiedDate interface Documentation

You just need to tell to imageresizer that image was modified via this interface

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top