SizeCalculator

typealias SizeCalculator<K, V> = (key: K, value: V) -> Long

A function for calculating the size of a cache entry represented by the provided key * and value.

For example, for String, you can use:

{ _, text -> text.length }

If the entries have the same size or their size can't be determined, you can just return 1.