Contain cache key handling in Element class
The decision which cache key to use is not always trivial. Keep that knowledge contained in one place, the Element class. This also eliminates duplicated logic between OSTreeCache and TarCache and will be useful for implementing future artifact cache backends.