Decoupled from internal Aether util class (for the sake of licensing imported from https://github.com/sonatype/sonatype-aether/blob/aether-1.7/aether-impl/src/main/java/org/sonatype/aether/impl/internal/CacheUtils.java)