Caching of blobs using flat files

Eventually we need to start caching Git blobs. For example, when we highlight a diff we load the old/new version of a blob (the entire blob). Once loaded we highlight both blobs, then use this to construct a diff.

This means that for every diff we not only load diff data from the repository, but also at least 2 blobs per changed file. Loading blobs in turn is both CPU and memory intensive. Gitaly should cache blobs in a flat file. We can not use Redis as per @jacobvosmaer-gitlab each key can at most store 512 MB of data.

These files should be removed whenever the source blob is no longer available. The easiest way is to set some kind of timeout. For example, a cache file would be removed 2 weeks after being used for the last time (or after being created).

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information