macmemo
macmemo copied to clipboard
The annotation only accept const value
The following code not works:
import com.softwaremill.macmemo.memoize
class GraphBuilder {
val max = 20000
// val max = read from props file.
@memoize(maxSize = max, expiresAfter = 2 hours)
def creatGraph(elementCount: Int): Graph = {
someExpensiveCode()
}
}
what about making the parameters are call by name? just like this:
class memoize(maxSize: => Long, expiresAfter: => FiniteDuration, concurrencyLevel: => Option[Int] = None)