com.twitter.storehaus.cache
Returns an instance of Function1 memoized using the supplied mutable cache.
scala> import com.twitter.storehaus.cache._ scala> type Input = (Int) scala> val cache = MapCache.empty[Input, String].toMutable() cache: <munged> scala> val memoFn = Memoize(cache) { (x1) => | println("calculating!") | (x1).toString | } memoFn: <munged> scala> memoFn(1) calculating! res0: String = (1) scala> memoFn(1) res1: String = (1)
Returns an instance of Function1 memoized using the supplied mutable cache.