@babbage My testing on that, ended up not working because the cost of maintaining a (fast and reliable) very large database with all files is more expensive than the storage space.
Also, I have automated cache cleaning in place: https://masto.host/re-mastodon-media-storage/
But there could be better ways of doing it, I just haven't found one where the CPU/RAM costs are not higher than the storage.
Also, bandwidth costs are many times more significant than storage and those cannot be offset.