Clearing ImageCache


#1

It doesn’t look like there’s a quick way to clear the ImageCache, unless I’m missing something obvious. Yes, I know that if I’m loading images from it, I can clear/remove the image that I’m drawing in my component. But I have a situation here where I need to quickly wipe all images. I’m working on an app that fetches various images from a web service and and I need to clear the cache every once in a while to reflect changes on the server.

Is Juce using ImageCache to store images for use with the framework?

Would be a cool feature to set the total number of images that can be cached. -1 would mean that it works as is, and > 1 limits it, so any new image added would throw away the earlier one(s).

How about a method that returns a list of HashCodes that we can iterate through and manage the cache that way. I think this would be best.

I’d hate to copy the damn thing and add it. I feel so bad when I do that for some reason…

Thanks


#2

Yeah, it’s not really designed for that kind of duty, it’s more for sharing fixed images that don’t change.

You can add an image to the cache with your own hashcode, can’t you? You could always have a smarter hash algorithm that changes when the images need updating…