Refactor parts of in_delta_base_cache/cache_or_unpack_entry