Issue #1858616 by Berdir: Extract generic CacheCollector implementation and interface from CacheArray.