Added 'isImageDataValid' before storing image in Cache