Improve cache management
Currently the cache downloads an image several times, even if this was already downloaded, as images have different identifiers. We should try to minimize downloads. We can store the images based on their SHAs, so that the same image with two different IDs is not downloaded twice.