image cacher refactored for scala