File/ImageCache change detection


#1

I use ImageCache to load files and display them. I wanted to give the user the ability to change the displayed image, and using ImageCache that works but only if the source file changes it's name/localtion, if the change occurs on the contents of the file only the hashCode64 method does not change and ImageCache does not pick up the change.

This is because the hashCode64 is calculated based on the fullPath of the file it does not check for anything else.

 

Would it be possible to base the hashCode/hashCode64 methods on the modification date (unix timetstamp)of the file, and maybe add a parameter to ImageCache to force re-load the cache contents when using the getFromFile() method ?


Reimport an image after it changes
#2

No, that's way beyond the remit of the cache class, and repeatedly hitting the disk to check time-stamps every time would probably mess up other people's code, even if it happens to be what you need. You could implement the same thing yourself though - the ImageCache lets you supply your own hash-code, and load the image yourself, so you could use a hash based on the file path + timestamp or whatever you want.


#3

Allright i'll do that. Thanks.