withStatsCounter¶
Applies the StatsCounter to the Caffeine cache builder if it's non-null, or otherwise doesn't register it.
withStatsCounter exists because Caffeine.recordStats itself doesn't handle null stats counters.
Beware: Some operations of Cache.asMap do not record stats, so it's recommended to use the Caffeine cache directly.