Scalaz provides Memo for memoization. I hope scala-cats also has a similar solution. In general I have a trait with different methods:
trait t {
def f1:Int = ???
def f2(i:Int):Int = ???
def f3(i:Int, s:String):String = ???
}
If such solution is supported by Casts, can you please give an example, how to:
use it to memoizate all previously defined methods in case sources can be modified?
how to apply it to the external code, to inject memoization to client's invocation, without touching existing services
how to control lifecycle of memoization? In general I need to keep results per transaction. What are strategies to control it? Examples would be also great!