upgraded getImageCache function