tgjones / dynamic-image

DynamicImage is a high-performance image manipulation library for ASP.NET
http://dynamicimage.apphb.com/
Other
145 stars 34 forks source link

How do I invalidate the cache? #20

Closed fmmsilva closed 9 years ago

tgjones commented 10 years ago

There isn't anything built-in for that at the moment. DynamicImage uses cache keys that are built from the composition and all its layers and filters. If you change any property on any of those things, it will result in a new cache key, and a new image.

What's your use-case for having an explicit way to invalidate the cache?

fmmsilva commented 9 years ago

I need to rebuild the cache when I update the content of an image but use the same filename and all the same filters. I did some updates on some of your classes and I think I got it. Thank you!

tgjones commented 9 years ago

Actually there is something you can use - sorry, I forgot about it before ;-)


var imageSource = new FileImageSource
{
    FileName = "/myimage.png"
};
DynamicImageCacheManager.Remove(imageSource);

That will remove from the cache any images that use that image source.