I’m not aware of a non-deprecated way to achieve this. I’ve added a story to the design doc to cover this use case. https://github.com/gradle/gradle/blob/master/design-docs/repository-transports.md#allow-caching-for-a-slow-file-backed-repository
If you’re interested in getting involved by contributing a solution, please raise this as a topic on the developer list.